From patchwork Mon Oct 4 13:46:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12534243 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 6A748C433F5 for ; Mon, 4 Oct 2021 14:54:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E5585611C0 for ; Mon, 4 Oct 2021 14:53:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E5585611C0 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 82F3A940050; Mon, 4 Oct 2021 10:53:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DE6D94000B; Mon, 4 Oct 2021 10:53:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CDFB940050; Mon, 4 Oct 2021 10:53:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 5938094000B for ; Mon, 4 Oct 2021 10:53:59 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1E9F2181AF5C1 for ; Mon, 4 Oct 2021 14:53:59 +0000 (UTC) X-FDA: 78659049798.02.43AB107 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id CEB96D0389FF for ; Mon, 4 Oct 2021 14:53:58 +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=dxzaPSBzfY0SrjP2w2cNw5gqRiPW5D1VARcKJPnKPv0=; b=oW2iIvdE9U97oMshStcSVtDteN vXqi5Q14GotqcBDfKSCex4YQJ2Ip/7V6YwtzwvGRv9YLX1gXA0aGcYSQlvC/AUUM1qtlyPmATSCxV cX00r5hxBfF1FreJ42Gk1M5T3yoO2e8psGcA6VuEbcxt4Y85bw7Vn1YaN8lbwPjNKllSR5iVjxwbA vuV33udEqrDQRhBg28tsTi+QVFuRu4nxrec4s0d005B+8bVswBI4dtDeGid23IPkmPtOteZ/veDcv USUtl4ocrtYor4MjypO0fHGvS7jKkD8VtvUWnknXpwVh09Ad0OGG+UimhWsz+ls3/x1X3TgJ08bLA aSbacz2A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXPJy-00H1hV-Vc; Mon, 04 Oct 2021 14:52:20 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 52/62] mm/slub: Convert pfmemalloc_match() to take a struct slab Date: Mon, 4 Oct 2021 14:46:40 +0100 Message-Id: <20211004134650.4031813-53-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: CEB96D0389FF X-Stat-Signature: 7pj7cbzuw6no7zdefn435ne5js85s59h Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oW2iIvdE; 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: 1633359238-779704 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 and removes calls to slab_page(). 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 24111e30c7a2..7e2c5342196a 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2083,7 +2083,7 @@ static void put_cpu_partial(struct kmem_cache *s, struct slab *slab, int drain); static inline void put_cpu_partial(struct kmem_cache *s, struct slab *slab, int drain) { } #endif -static inline bool pfmemalloc_match(struct page *page, gfp_t gfpflags); +static inline bool pfmemalloc_match(struct slab *slab, gfp_t gfpflags); /* * Try to allocate a partial slab from a specific node. @@ -2110,7 +2110,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, list_for_each_entry_safe(slab, slab2, &n->partial, slab_list) { void *t; - if (!pfmemalloc_match(slab_page(slab), gfpflags)) + if (!pfmemalloc_match(slab, gfpflags)) continue; t = acquire_slab(s, n, slab, object == NULL, &objects); @@ -2788,9 +2788,9 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid) #endif } -static inline bool pfmemalloc_match(struct page *page, gfp_t gfpflags) +static inline bool pfmemalloc_match(struct slab *slab, gfp_t gfpflags) { - if (unlikely(PageSlabPfmemalloc(page))) + if (unlikely(slab_test_pfmemalloc(slab))) return gfp_pfmemalloc_allowed(gfpflags); return true; @@ -3017,7 +3017,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, } } - if (unlikely(!pfmemalloc_match(slab_page(slab), gfpflags))) + if (unlikely(!pfmemalloc_match(slab, gfpflags))) /* * For !pfmemalloc_match() case we don't load freelist so that * we don't make further mismatched allocations easier.