Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp650526pxt; Thu, 5 Aug 2021 08:24:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzS/BvNmGWqt4ZLFKukvr5k0AF9AdQwADrKd79UGjv939dKKtfEmiAVnCPGSB005NmGlSy X-Received: by 2002:a02:c6d5:: with SMTP id r21mr5202440jan.71.1628177097943; Thu, 05 Aug 2021 08:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628177097; cv=none; d=google.com; s=arc-20160816; b=ucaKkqAsfa+UF3cJQ82tvY27pPkudtPXYKroYK2Y1MB/Q4XfRz6d9rmdmXaEAPt6Qf FcXvJDUoiqgRNs1yHm35WLdefrrOCLQ0VR8+EAYvTBObBRAw83St14ymbN0vyb7Ep1Bn xfVm8xarJjx/ycDGjdLqGVH2JokEt95qpqfTNR4lQBUoLcAzKAe9vRoCb2XRbp/09+nq CenY7LvFjyQeUyW73X+ni3UvzcFVjtQ+zqqb82bFS1Bojf2J2t8LG8/20zge/cuYfBzD FqiiLJsEUWTgFWuvmH8y9cjjVu64XWUp9+KurIBXKdG0tScfSrheJemBxTiJckkVExuc 4PYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=2LLN8HoB0OW5Nu7QA8UyVmLNoWvJh0vRpiWBSiJ4w6Y=; b=wAaU11DPvW3njT6lLtcUx/Nzm6CrQdnNsQG4puKg3OLUPotCHm9bS4+NmL115yvK0C aneOWdmzEbzntrqEiJrYVTE3DKMMRRkgCvlHsDG61vrYvazbGNFis17E12igrpAqSQY5 SOLij48hX4uvi9tONkNBNAKiEPARJ4A51hqmRX74DzhM0Ay7YPr7VWZOQdOEsA2ma+D9 DdeP0mvokHihnZil3eW+wTpnXbPbkyj7SBJadZ2P+g2810pZU/REQMsAptmQHucb4AoX SLcvEIs78uXubgzSDTMJqmxkLE7P7nLWPCkGRgCpmyk6sy8kJei65/bmjlbeRgkxJsk6 rf6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AConPxPP; dkim=neutral (no key) header.i=@suse.cz header.b=O04iGvfp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 15si6718601ilz.158.2021.08.05.08.24.46; Thu, 05 Aug 2021 08:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AConPxPP; dkim=neutral (no key) header.i=@suse.cz header.b=O04iGvfp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242141AbhHEPV4 (ORCPT + 99 others); Thu, 5 Aug 2021 11:21:56 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:59186 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241866AbhHEPUU (ORCPT ); Thu, 5 Aug 2021 11:20:20 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7291A2024A; Thu, 5 Aug 2021 15:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1628176805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2LLN8HoB0OW5Nu7QA8UyVmLNoWvJh0vRpiWBSiJ4w6Y=; b=AConPxPPgg2mn3dxSt3H/SGSjF2f056aKzcWkJtWU2FeVP4lLIKiMs1Nm6TwkBFBS0tChh EIt/le8tmmr86I7Y51uZqS1KCAFA0Vb84RYQjviNJRjs7bUI3bpogLB9HrN/zGQt+sIMgP rz1LYNWK8+MikqkE7owGQcAVFzrg2/c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1628176805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2LLN8HoB0OW5Nu7QA8UyVmLNoWvJh0vRpiWBSiJ4w6Y=; b=O04iGvfpuXAhE/JE4aPg5+x0XAc6IsNEqMc713N0SaxXFhy5uGzAxGQU/ID3K81UuoSUvT f9kwze3rMKk8X+DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3F59113DAC; Thu, 5 Aug 2021 15:20:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gIPZDqUBDGFDdQAAMHmgww (envelope-from ); Thu, 05 Aug 2021 15:20:05 +0000 From: Vlastimil Babka To: Andrew Morton , Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Galbraith , Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Jann Horn , Vlastimil Babka Subject: [PATCH v4 07/35] mm, slub: extract get_partial() from new_slab_objects() Date: Thu, 5 Aug 2021 17:19:32 +0200 Message-Id: <20210805152000.12817-8-vbabka@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210805152000.12817-1-vbabka@suse.cz> References: <20210805152000.12817-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The later patches will need more fine grained control over individual actions in ___slab_alloc(), the only caller of new_slab_objects(), so this is a first preparatory step with no functional change. This adds a goto label that appears unnecessary at this point, but will be useful for later changes. Signed-off-by: Vlastimil Babka Acked-by: Christoph Lameter --- mm/slub.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 15edf260632e..25f102acf5b4 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2596,17 +2596,12 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid) static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags, int node, struct kmem_cache_cpu **pc) { - void *freelist; + void *freelist = NULL; struct kmem_cache_cpu *c = *pc; struct page *page; WARN_ON_ONCE(s->ctor && (flags & __GFP_ZERO)); - freelist = get_partial(s, flags, node, c); - - if (freelist) - return freelist; - page = new_slab(s, flags, node); if (page) { c = raw_cpu_ptr(s->cpu_slab); @@ -2770,6 +2765,10 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, goto redo; } + freelist = get_partial(s, gfpflags, node, c); + if (freelist) + goto check_new_page; + freelist = new_slab_objects(s, gfpflags, node, &c); if (unlikely(!freelist)) { @@ -2777,6 +2776,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, return NULL; } +check_new_page: page = c->page; if (likely(!kmem_cache_debug(s) && pfmemalloc_match(page, gfpflags))) goto load_freelist; -- 2.32.0