From patchwork Mon Oct 4 13:46:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12534041 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 67ABBC433EF for ; Mon, 4 Oct 2021 14:10:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0681161216 for ; Mon, 4 Oct 2021 14:10:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0681161216 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 8DA9F940029; Mon, 4 Oct 2021 10:10:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88D3394000B; Mon, 4 Oct 2021 10:10:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A08D940029; Mon, 4 Oct 2021 10:10:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 6C6B494000B for ; Mon, 4 Oct 2021 10:10:06 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 194AB18280027 for ; Mon, 4 Oct 2021 14:10:06 +0000 (UTC) X-FDA: 78658939212.35.9784913 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id B0EDDD038252 for ; Mon, 4 Oct 2021 14:10:05 +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=yQh4jCE7s08sk7cRWN15Crj+RcQAcSB4bHSQ+00lqjk=; b=P5uoZLigJMTdtvqXhfxjbyCDBR XbWGIBvOeO+WPfMxwSvQUOvIM9PujIn3SZXVMRlk94KEW2iJjoIbDP1i+nIW3j5AKSay02JUHCvaJ luvET0Miuqz4LXEJUREz8PSU+U0dIBRhBa95Cw2U9mKFkKsbVvVx30sfcN6mQ/bxIE1/PNpwsXjDo FSjMa+Sts7lJaKsXulnXTzj/qLBP7b1mGbk1Zor4Cct52d4m4o2qR2psa+BU20uOJttE7mF6GOvLD k895p9Epk2x3xdPU9T0kane7QtDTrbDg4La/h6TKVSymHoqxOj9Kt244Tqxu9gHb6KwHK5k001RrO BbYrHOVw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOcK-00GxHz-8a; Mon, 04 Oct 2021 14:07:32 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 18/62] mm/slub: Convert count_partial() to struct slab Date: Mon, 4 Oct 2021 14:46:06 +0100 Message-Id: <20211004134650.4031813-19-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 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=P5uoZLig; spf=none (imf21.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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B0EDDD038252 X-Stat-Signature: arciiz9mokoedofjp6c1s9d7346gnmh8 X-HE-Tag: 1633356605-100547 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 all its helper functions at the same time. Adds a little typesafety. 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 5e10a9cc6939..fc1a7f7832c0 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2730,9 +2730,9 @@ static inline int node_match(struct page *page, int node) } #ifdef CONFIG_SLUB_DEBUG -static int count_free(struct page *page) +static int count_free(struct slab *slab) { - return page->objects - page->inuse; + return slab->objects - slab->inuse; } static inline unsigned long node_nr_objs(struct kmem_cache_node *n) @@ -2743,15 +2743,15 @@ static inline unsigned long node_nr_objs(struct kmem_cache_node *n) #if defined(CONFIG_SLUB_DEBUG) || defined(CONFIG_SYSFS) static unsigned long count_partial(struct kmem_cache_node *n, - int (*get_count)(struct page *)) + int (*get_count)(struct slab *)) { unsigned long flags; unsigned long x = 0; - struct page *page; + struct slab *slab; spin_lock_irqsave(&n->list_lock, flags); - list_for_each_entry(page, &n->partial, slab_list) - x += get_count(page); + list_for_each_entry(slab, &n->partial, slab_list) + x += get_count(slab); spin_unlock_irqrestore(&n->list_lock, flags); return x; } @@ -4944,14 +4944,14 @@ EXPORT_SYMBOL(__kmalloc_node_track_caller); #endif #ifdef CONFIG_SYSFS -static int count_inuse(struct page *page) +static int count_inuse(struct slab *slab) { - return page->inuse; + return slab->inuse; } -static int count_total(struct page *page) +static int count_total(struct slab *slab) { - return page->objects; + return slab->objects; } #endif