From patchwork Mon Oct 4 13:46:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12534017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0488C4332F for ; Mon, 4 Oct 2021 14:06:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 47D7C6124F for ; Mon, 4 Oct 2021 14:06:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 47D7C6124F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E0DBD940026; Mon, 4 Oct 2021 10:06:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DBD9094000B; Mon, 4 Oct 2021 10:06:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAC80940026; Mon, 4 Oct 2021 10:06:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id BAC4A94000B for ; Mon, 4 Oct 2021 10:06:40 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 66BA72D3A0 for ; Mon, 4 Oct 2021 14:06:40 +0000 (UTC) X-FDA: 78658930560.17.A642692 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id 025676002FCB for ; Mon, 4 Oct 2021 14:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=IcIZfDe6bRASper2161FIhxyOnyUhqvkRgXrt9VdUBU=; b=nxD5HJJaL4kO3v9iN1JbZXgNwt zqeVSt1KO4fgaZkzNSoqIeL2smZhiEG5Qw4LORLGG4r6zWX3TmyhD2LEVr32NunO3r/xGh99/pGS1 r8zA0eYHQ58r32OKSFPZTaO3xM5Pvns1k3ShWmNc7/5gCbagc9XAnrJg8zQYmDUD0y8rD8P93MFbd EraozWRvyVG+reMKtnXtkszUXHfW4g1iDGNpHXxzvbV3RG96cQDVBUdFwuDhlQgsuU1kanQulKl7z B1dRensB9eHtC6Ey2+rV4atNsebJFOzHCsv/MOd1Nl63lLa0krgFKLYtlcooOAk2x15wVtTeArbOW OwRZpDyA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOaZ-00Gwyw-7x; Mon, 04 Oct 2021 14:05:26 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 16/62] mm/slub: Convert show_slab_objects() to struct slab Date: Mon, 4 Oct 2021 14:46:04 +0100 Message-Id: <20211004134650.4031813-17-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004134650.4031813-1-willy@infradead.org> References: <20211004134650.4031813-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 025676002FCB X-Stat-Signature: e3zpwexk5iw8ys96rgu7own3n66cy4wd Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=nxD5HJJa; dmarc=none; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1633356399-740457 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Adds a little bit of type safety. Signed-off-by: Matthew Wilcox (Oracle) --- mm/slub.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index d849b644d0ed..fdf3dbd4665f 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5219,32 +5219,32 @@ static ssize_t show_slab_objects(struct kmem_cache *s, struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); int node; - struct page *page; + struct slab *slab; - page = slab_page(READ_ONCE(c->slab)); - if (!page) + slab = READ_ONCE(c->slab); + if (!slab) continue; - node = page_to_nid(page); + node = slab_nid(slab); if (flags & SO_TOTAL) - x = page->objects; + x = slab->objects; else if (flags & SO_OBJECTS) - x = page->inuse; + x = slab->inuse; else x = 1; total += x; nodes[node] += x; - page = slab_page(slub_percpu_partial_read_once(c)); - if (page) { - node = page_to_nid(page); + slab = slub_percpu_partial_read_once(c); + if (slab) { + node = slab_nid(slab); if (flags & SO_TOTAL) WARN_ON_ONCE(1); else if (flags & SO_OBJECTS) WARN_ON_ONCE(1); else - x = page->pages; + x = slab->slabs; total += x; nodes[node] += x; }