From patchwork Mon Oct 4 13:46:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12534081 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 1A787C433EF for ; Mon, 4 Oct 2021 14:15:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF97861251 for ; Mon, 4 Oct 2021 14:15:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AF97861251 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 4DBF294002D; Mon, 4 Oct 2021 10:15:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48AE794000B; Mon, 4 Oct 2021 10:15:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A1A794002D; Mon, 4 Oct 2021 10:15:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id 2A7A094000B for ; Mon, 4 Oct 2021 10:15:40 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E1CA02D248 for ; Mon, 4 Oct 2021 14:15:39 +0000 (UTC) X-FDA: 78658953198.03.D86F544 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id A52ACF000AEA for ; Mon, 4 Oct 2021 14:15: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=0CBV26gMpDyHnBtt1L8euXGcM6/GY9CP3dzT+jXyX+g=; b=nNvsFvAZJV6Y7sAp2RIJrI+2RE T4q85VYLWMx0zVNBMQRJMOxe5qzy8GA9//8MURtO5dCXE16S7BlNWWjZgCgrMMff7Fx/U/6IWdtG2 /wEzScaIVCS/rakj7MyBRcTZI+yGuLS2hJ6SOtHGqrPcD9xjQAGjfVar01YjfoxijuH78n+ucIxQX 4oDpd/yIXWOdqTUOfco8yWzygyylz9OycgA+uZjPD5F8x8EXoKXrm8ZH94LYDz+uAQ4eY6fmSKUOw H9m8JEuVXug/x0o6ppmtQ4+DWNTbdZ86Ib2mX12oIC5m7+ctJ5q/PLJtN3JR9KQOy/6+OJMYyFBeP ttob04Gw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOiG-00GxzZ-G6; Mon, 04 Oct 2021 14:13:51 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 22/62] mm/slub: Convert list_slab_objects() to take a struct slab Date: Mon, 4 Oct 2021 14:46:10 +0100 Message-Id: <20211004134650.4031813-23-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: rspam02 X-Rspamd-Queue-Id: A52ACF000AEA X-Stat-Signature: fppg9rebigrcgcptru9xrihsmnmwcomp Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=nNvsFvAZ; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1633356939-556579 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: Convert the one caller to pass a slab instead. Adds a little type safety. Signed-off-by: Matthew Wilcox (Oracle) --- mm/slub.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 875f3f6c1ae6..29703bba0a7f 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4208,20 +4208,20 @@ static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags) return -EINVAL; } -static void list_slab_objects(struct kmem_cache *s, struct page *page, +static void list_slab_objects(struct kmem_cache *s, struct slab *slab, const char *text) { #ifdef CONFIG_SLUB_DEBUG - void *addr = page_address(page); + void *addr = slab_address(slab); unsigned long flags; unsigned long *map; void *p; - slab_err(s, page, text, s->name); - slab_lock(page, &flags); + slab_err(s, slab_page(slab), text, s->name); + slab_lock(slab_page(slab), &flags); - map = get_map(s, page); - for_each_object(p, s, addr, page->objects) { + map = get_map(s, slab_page(slab)); + for_each_object(p, s, addr, slab->objects) { if (!test_bit(__obj_to_index(s, addr, p), map)) { pr_err("Object 0x%p @offset=%tu\n", p, p - addr); @@ -4229,7 +4229,7 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page, } } put_map(map); - slab_unlock(page, &flags); + slab_unlock(slab_page(slab), &flags); #endif } @@ -4250,7 +4250,7 @@ static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n) remove_partial(n, slab_page(slab)); list_add(&slab->slab_list, &discard); } else { - list_slab_objects(s, slab_page(slab), + list_slab_objects(s, slab, "Objects remaining in %s on __kmem_cache_shutdown()"); } }