From patchwork Mon Oct 4 13:46:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12534083 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 20356C433EF for ; Mon, 4 Oct 2021 14:18:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C49DB61215 for ; Mon, 4 Oct 2021 14:18:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C49DB61215 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 59BA494002E; Mon, 4 Oct 2021 10:18:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54B3194000B; Mon, 4 Oct 2021 10:18:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43A0494002E; Mon, 4 Oct 2021 10:18:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 374F994000B for ; Mon, 4 Oct 2021 10:18:17 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E06112AF06 for ; Mon, 4 Oct 2021 14:18:16 +0000 (UTC) X-FDA: 78658959792.08.8DDB0B6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id A53442002830 for ; Mon, 4 Oct 2021 14:18:16 +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=VO+yFyY2quDkQ0TLFd7cnnSzmCRrtWwgOmru8Ju/QdI=; b=jalF9vWDUSbSK6ZR7yzvdRqbU0 Cx3letVgOwv1tRw0vtYpObEWJw9WLiDjuc4pjVUJ0zajwX5JXHIHRjwRXjIt9TsKu3hy+08o1GnHA DVg/8F5ZZHV6hDCNpLH7TCQ/X7au4vykbG4bXmQ9xxxz1obI2z75eOBJswW7VPHoZK8aPMBL1RvQR /n6Kdh5efSTtnqv8U+5trldKFwtR+WmWxwd9RWeHgfUjO0jgeCcHZJLaxLZFk1hrmntMLeETU6TrT NgKK8FKuWi3t/wjbe/kFop9VENFX5G7FH8uzHBqbm29CQMEYIlvkTuAETuTDNfAn/J+1aqB/rkRM3 g6plR6Bw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOkC-00Gy8t-Pv; Mon, 04 Oct 2021 14:15:22 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 23/62] mm/slub: Convert slab_alloc_node() to use a struct slab Date: Mon, 4 Oct 2021 14:46:11 +0100 Message-Id: <20211004134650.4031813-24-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: A53442002830 X-Stat-Signature: ps56t8ux394q69fg1onoy9q7d68m7qch Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jalF9vWD; spf=none (imf26.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: 1633357096-400925 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 type safety. Signed-off-by: Matthew Wilcox (Oracle) --- mm/slub.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 29703bba0a7f..fd04aa96602c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3112,7 +3112,7 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, { void *object; struct kmem_cache_cpu *c; - struct page *page; + struct slab *slab; unsigned long tid; struct obj_cgroup *objcg = NULL; bool init = false; @@ -3144,9 +3144,9 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, /* * Irqless object alloc/free algorithm used here depends on sequence * of fetching cpu_slab's data. tid should be fetched before anything - * on c to guarantee that object and page associated with previous tid + * on c to guarantee that object and slab associated with previous tid * won't be used with current tid. If we fetch tid first, object and - * page could be one associated with next tid and our alloc/free + * slab could be one associated with next tid and our alloc/free * request will be failed. In this case, we will retry. So, no problem. */ barrier(); @@ -3159,7 +3159,7 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, */ object = c->freelist; - page = slab_page(c->slab); + slab = c->slab; /* * We cannot use the lockless fastpath on PREEMPT_RT because if a * slowpath has taken the local_lock_irqsave(), it is not protected @@ -3168,7 +3168,7 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, * there is a suitable cpu freelist. */ if (IS_ENABLED(CONFIG_PREEMPT_RT) || - unlikely(!object || !page || !node_match(page, node))) { + unlikely(!object || !slab || !node_match(slab_page(slab), node))) { object = __slab_alloc(s, gfpflags, node, addr, c); } else { void *next_object = get_freepointer_safe(s, object);