Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3845847pxj; Mon, 24 May 2021 16:42:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/OAbZkpvkVEuQfMuO5lSAq5vM3KrAIOKPdnDSUGjYBbB6vkeTUaJmULNgcCid1vNvHY5S X-Received: by 2002:a17:906:c218:: with SMTP id d24mr25060838ejz.363.1621899769275; Mon, 24 May 2021 16:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621899769; cv=none; d=google.com; s=arc-20160816; b=bJhs9FMs5Tgg2C0T3x9n6yBy65Dpkh172yI6tsLPLnca2r8JZA/3ACGZ1HV9wWiYJ7 Bge6qb3ITZWJeJMlxVG6l9NMDBSFO1KoKjJ88IYfbgU1bV3KZVvsB91mfMz/KHTZkuut 5W2i25PLkx7Ns28lMQpEFboYK5LGBMoK/Hl+w/u8scYutOBLByjWR8In5bkKtblaeGHn U1UqwGs+Sy6Eu4LjFRhGIXAZ1SGELTpXmRstXSdKeKQV6VS8CWBTGw7uis/E1Zsg3PFM BrYFJBWiT6Xm71wZM0iPcxk5L9rzVy4lpCo7dC++IvxyBeIEp7zKGOGa2ILWZHhy2PFp a3iA== 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=RnmATVE2cFsOM4l8AU+rjNgF4Z1lvhgPiSG7YMvlexg=; b=tSiVPOen48PpR7GSSPgV1LF+dfP9i93zfq0aBhI1lGuS48wOlad3DmKa+LvXdQ7Vbp wmamuI+qbKDTiMmvdmpFo+lkQBcfoklOPweS2eNoY8GkzNwTYtREVFGQUKPov0xHQRng foDVTPFdl5winsHMtWNC0drVvR3r9vxnZgEQRzh4edYM1hzpwXIAD4lEjPFzCeWJhFiD pMDRewvGucdFMxHP4cvdp3x72zLGBAoRlbmg1Okx4+0VhJjWH7wZxqtNttJW8FHmRQV0 CVmcBNx7rYr8YUpDpOYLJx33qNiOAns3xZv7Pd8Kgi6FujFP4Oi2UViiA9qqrgoiTgqF CtCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=PCqD7jpS; dkim=neutral (no key) header.i=@suse.cz; 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 y22si11954141edu.331.2021.05.24.16.42.26; Mon, 24 May 2021 16:42:49 -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=PCqD7jpS; dkim=neutral (no key) header.i=@suse.cz; 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 S230093AbhEXXmb (ORCPT + 99 others); Mon, 24 May 2021 19:42:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:50686 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229826AbhEXXmU (ORCPT ); Mon, 24 May 2021 19:42:20 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1621899648; 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=RnmATVE2cFsOM4l8AU+rjNgF4Z1lvhgPiSG7YMvlexg=; b=PCqD7jpSrVK8HyL9jdefa4okGaF8URkbUPTvS1m8iJQs7RkvR4E+TxDOi2E7QKvwcyiPjF LGLm8KZBbUk5f35DlF3O5sDbtsrLZjiDj1G2bl6e/MrSjlygqVsqqPQVscvZe/s31Ytep9 U9Bm+17Du0r3VrUKiXi3IGXDLSfgotA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1621899648; 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=RnmATVE2cFsOM4l8AU+rjNgF4Z1lvhgPiSG7YMvlexg=; b=i59ySutqAGdk3OtHuYoc298S5w1Eyhuxp3sYi//yJVEvDMMCwPdidLLHIJPJtqeHfc9ydT kf9McfvjHHvRAmCg== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 27BA6AF23; Mon, 24 May 2021 23:40:48 +0000 (UTC) From: Vlastimil Babka To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Peter Zijlstra , Jann Horn , Vlastimil Babka Subject: [RFC 05/26] mm, slub: extract get_partial() from new_slab_objects() Date: Tue, 25 May 2021 01:39:25 +0200 Message-Id: <20210524233946.20352-6-vbabka@suse.cz> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524233946.20352-1-vbabka@suse.cz> References: <20210524233946.20352-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. Signed-off-by: Vlastimil Babka --- mm/slub.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 7b4cdc59b9ff..7973bcd42bc7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2574,17 +2574,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); @@ -2748,6 +2743,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)) { @@ -2755,6 +2754,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.31.1