From patchwork Mon Oct 4 13:46:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12534127 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 F0DB7C433F5 for ; Mon, 4 Oct 2021 14:26:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7A26261251 for ; Mon, 4 Oct 2021 14:26:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7A26261251 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 173E3940035; Mon, 4 Oct 2021 10:26:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 126A094000B; Mon, 4 Oct 2021 10:26:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 039C5940035; Mon, 4 Oct 2021 10:26:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id E790B94000B for ; Mon, 4 Oct 2021 10:26:20 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A79CD8249980 for ; Mon, 4 Oct 2021 14:26:20 +0000 (UTC) X-FDA: 78658980120.18.43074D4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf20.hostedemail.com (Postfix) with ESMTP id 5DE00D001BB9 for ; Mon, 4 Oct 2021 14:26:20 +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=Eak+V8QsxEznXLKuUCzr08pMoWS7JY5BsWW/Agcv3Hk=; b=f/almd+bWxaTlMsZ+lKeCDxAQi qiHeDkSVPJto6Mo78qP0rwAVBQrbExJmAEt8FqWZMOakhYSyGlTQfqj7ZNdSdAtXm6UrpDNUdGIfb 2ydyefsmTIs05QuIkaHf4yhS0bNX4tiTcRuDs2m9QxTgHZ1GAl4fw/FpEPc85ZN/9/gqbPhPeMLJL 5MADSDbk1pT6e4HS2ienlLzcdV6nyNY+wRdyZX3F1G2pAfzjMoyyvSR5pXU6jat2AWcTdQBvLIOMb w6Of8ALrCRaEZiKd4y7pj4tLktAeF3bFVeMogq8Mb/ZldLoQWt4U6ybdNaAMO5Uu+Pa3KGxZo1eGG z0ENDUfA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOsJ-00Gz6O-0A; Mon, 04 Oct 2021 14:23:55 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 29/62] mm/slub: Convert acquire_slab() to take a struct page Date: Mon, 4 Oct 2021 14:46:17 +0100 Message-Id: <20211004134650.4031813-30-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: 5DE00D001BB9 X-Stat-Signature: qkmkxk64eyq1z97irk8hkits9swy6ktg Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="f/almd+b"; dmarc=none; spf=none (imf20.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: 1633357580-175254 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: Improves 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 5330d0b02f13..3468f2b2fe3a 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2044,12 +2044,12 @@ static inline void remove_partial(struct kmem_cache_node *n, * Returns a list of objects or NULL if it fails. */ static inline void *acquire_slab(struct kmem_cache *s, - struct kmem_cache_node *n, struct page *page, + struct kmem_cache_node *n, struct slab *slab, int mode, int *objects) { void *freelist; unsigned long counters; - struct page new; + struct slab new; lockdep_assert_held(&n->list_lock); @@ -2058,12 +2058,12 @@ static inline void *acquire_slab(struct kmem_cache *s, * The old freelist is the list of objects for the * per cpu allocation list. */ - freelist = page->freelist; - counters = page->counters; + freelist = slab->freelist; + counters = slab->counters; new.counters = counters; *objects = new.objects - new.inuse; if (mode) { - new.inuse = page->objects; + new.inuse = slab->objects; new.freelist = NULL; } else { new.freelist = freelist; @@ -2072,13 +2072,13 @@ static inline void *acquire_slab(struct kmem_cache *s, VM_BUG_ON(new.frozen); new.frozen = 1; - if (!__cmpxchg_double_slab(s, page, + if (!__cmpxchg_double_slab(s, slab_page(slab), freelist, counters, new.freelist, new.counters, "acquire_slab")) return NULL; - remove_partial(n, page); + remove_partial(n, slab_page(slab)); WARN_ON(!freelist); return freelist; } @@ -2119,7 +2119,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, if (!pfmemalloc_match(slab_page(slab), gfpflags)) continue; - t = acquire_slab(s, n, slab_page(slab), object == NULL, &objects); + t = acquire_slab(s, n, slab, object == NULL, &objects); if (!t) break;