From patchwork Mon Oct 4 13:46:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12534103 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 41758C433EF for ; Mon, 4 Oct 2021 14:20:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFFD26121F for ; Mon, 4 Oct 2021 14:20:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CFFD26121F 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 6AC1794002F; Mon, 4 Oct 2021 10:20:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65AD194000B; Mon, 4 Oct 2021 10:20:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5499694002F; Mon, 4 Oct 2021 10:20:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 42C3394000B for ; Mon, 4 Oct 2021 10:20:08 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id ED2CB2D23B for ; Mon, 4 Oct 2021 14:20:07 +0000 (UTC) X-FDA: 78658964454.29.DEBD8AD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id A499DD0389F7 for ; Mon, 4 Oct 2021 14:20:07 +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=krFF0Z/a4Ew65k3tldk9lxA1Avqxu292lbtRxFqo2wM=; b=ZykqIvvFXC97I6bOUuQwmdbXVr 6AD7yUmZipaGvzvx9d9eEjgfEvBkHV3OZEYTddvpJTiNg7fMLr4s4M0VfL4FiGhvG23CZ4ISqZ0hc dtkjCRt3/ZVu4XI0HCdNCjyQmqyyZ1ek1G/rnPyll9x7j3Yb7YSdVAJLcQ+Ihn6Y4bEQ5jkh+cHzJ W0/a+p66HIzNJTpPT04JsxJ2DkUhWZ9Gjs9Q9hJ2nv5Ihjv+zTsriMJBw0lgLobLZbwURkOMdi1lO VfoVi0eYmd1QzngcD/yRW7z964H7jv3vDvxZfw2i0TAVpcQDRZf3tIlb+8bzZYvhOv/OC4Ry5T+8x Q7KhO0fQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOla-00GyFW-Iq; Mon, 04 Oct 2021 14:17:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 24/62] mm/slub: Convert get_freelist() to take a struct slab Date: Mon, 4 Oct 2021 14:46:12 +0100 Message-Id: <20211004134650.4031813-25-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: A499DD0389F7 X-Stat-Signature: 6a76d97soz7unc1q5eitbs3ykt4jwzkp Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZykqIvvF; dmarc=none; 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 X-HE-Tag: 1633357207-448626 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. Convert the one caller. Signed-off-by: Matthew Wilcox (Oracle) --- mm/slub.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index fd04aa96602c..827196f0aee5 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2816,32 +2816,32 @@ static inline bool pfmemalloc_match_unsafe(struct page *page, gfp_t gfpflags) } /* - * Check the page->freelist of a page and either transfer the freelist to the - * per cpu freelist or deactivate the page. + * Check the freelist of a slab and either transfer the freelist to the + * per cpu freelist or deactivate the slab * - * The page is still frozen if the return value is not NULL. + * The slab is still frozen if the return value is not NULL. * - * If this function returns NULL then the page has been unfrozen. + * If this function returns NULL then the slab has been unfrozen. */ -static inline void *get_freelist(struct kmem_cache *s, struct page *page) +static inline void *get_freelist(struct kmem_cache *s, struct slab *slab) { - struct page new; + struct slab new; unsigned long counters; void *freelist; lockdep_assert_held(this_cpu_ptr(&s->cpu_slab->lock)); do { - freelist = page->freelist; - counters = page->counters; + freelist = slab->freelist; + counters = slab->counters; new.counters = counters; VM_BUG_ON(!new.frozen); - new.inuse = page->objects; + new.inuse = slab->objects; new.frozen = freelist != NULL; - } while (!__cmpxchg_double_slab(s, page, + } while (!__cmpxchg_double_slab(s, slab_page(slab), freelist, counters, NULL, new.counters, "get_freelist")); @@ -2924,7 +2924,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, if (freelist) goto load_freelist; - freelist = get_freelist(s, slab_page(slab)); + freelist = get_freelist(s, slab); if (!freelist) { c->slab = NULL;