From patchwork Mon Oct 4 13:45:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12533987 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 A6442C433EF for ; Mon, 4 Oct 2021 13:59:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 518D16108F for ; Mon, 4 Oct 2021 13:59:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 518D16108F 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 E652594001E; Mon, 4 Oct 2021 09:59:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E138894000B; Mon, 4 Oct 2021 09:59:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D030194001E; Mon, 4 Oct 2021 09:59:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id C0DCF94000B for ; Mon, 4 Oct 2021 09:59:38 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 849C518233661 for ; Mon, 4 Oct 2021 13:59:38 +0000 (UTC) X-FDA: 78658912836.21.DB62BB6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id 411EB801B7F0 for ; Mon, 4 Oct 2021 13:59:38 +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=AMdVt1MO7X7URT1Zqnl/ga3S3L3V4jEvWQ8xBBzWwI0=; b=TUWppNiKwbk2AWFCEK4Es0Dyq4 7fFirnmnDkDzt1o5ZHOuUDvP+2SXP+MxGepmryatuCUktNKi54VEartbfH0TbaVXPGKtg9rdSK/l4 0Hj4wVmKj28254t0HEnoA3ZxToDvDrFwi1ovQ4EllsF/M/1jFNJftQ/HSmJcGN1Yj4h4W6Gg/iEMV f7Qfxg4MiQ6NG5BIaYm2c19dTS5KekU3KnD9O7V3Au2igT5Oi1I4uaO324Nholdv8YJTg0dK5QJJw OOG+80qftyMQ6g++AJduRZJzh01KgZa3cwxV51pPl5bOPNVqkuzcZLqVQGAiXmqw/iDLr3lOTEk26 hwph2Iew==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOU0-00GwAg-NI; Mon, 04 Oct 2021 13:58:31 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 09/62] mm/slub: Convert process_slab() to take a struct slab Date: Mon, 4 Oct 2021 14:45:57 +0100 Message-Id: <20211004134650.4031813-10-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: rspam03 X-Rspamd-Queue-Id: 411EB801B7F0 X-Stat-Signature: gow7acr6kyiswow8nsitc11uqacnqfgo Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=TUWppNiK; dmarc=none; spf=none (imf06.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: 1633355978-512598 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: Add some type safety by passing a struct slab instead of a struct page. Signed-off-by: Matthew Wilcox (Oracle) --- mm/slub.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index b34ca1ff3e1c..f5aadbccdab4 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5169,15 +5169,15 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, } static void process_slab(struct loc_track *t, struct kmem_cache *s, - struct page *page, enum track_item alloc, + struct slab *slab, enum track_item alloc, unsigned long *obj_map) { - void *addr = page_address(page); + void *addr = slab_address(slab); void *p; - __fill_map(obj_map, s, page); + __fill_map(obj_map, s, slab_page(slab)); - for_each_object(p, s, addr, page->objects) + for_each_object(p, s, addr, slab->objects) if (!test_bit(__obj_to_index(s, addr, p), obj_map)) add_location(t, s, get_track(s, p, alloc)); } @@ -6124,16 +6124,16 @@ static int slab_debug_trace_open(struct inode *inode, struct file *filep) for_each_kmem_cache_node(s, node, n) { unsigned long flags; - struct page *page; + struct slab *slab; if (!atomic_long_read(&n->nr_slabs)) continue; spin_lock_irqsave(&n->list_lock, flags); - list_for_each_entry(page, &n->partial, slab_list) - process_slab(t, s, page, alloc, obj_map); - list_for_each_entry(page, &n->full, slab_list) - process_slab(t, s, page, alloc, obj_map); + list_for_each_entry(slab, &n->partial, slab_list) + process_slab(t, s, slab, alloc, obj_map); + list_for_each_entry(slab, &n->full, slab_list) + process_slab(t, s, slab, alloc, obj_map); spin_unlock_irqrestore(&n->list_lock, flags); }