Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6093561pxv; Thu, 29 Jul 2021 06:23:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTNzb8QjN5hzG/OLvYN3pMhYkTf4cadEsb79JqZc/qWsJ4Zvv4Q+/6kTo75H2hcHxiAyg8 X-Received: by 2002:a92:c0c2:: with SMTP id t2mr3580548ilf.260.1627565013819; Thu, 29 Jul 2021 06:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627565013; cv=none; d=google.com; s=arc-20160816; b=haPytBS8ALdwAuECnV6xEL2Plxi5NfOBpJlLM/iIa6jBkr4R40DXuyHMLBIGtJcqt/ GVqGjCJmEt7K/HSuXdq+lNbSsJRkHUEmtd0O267nWWh7fdOzhI29BBXBHaMlCCcmWX79 b/QRjBibC8OjF1Faf1WwkjNjCaOCuBNixpuG5c6Ci3zUN2vEiVsBUn5JrCfqVBz3bXhS j2yEplC1kQgl+fOEI5NHo+mBjWC5D+TlW0kuksFFbjvmuVOGsKYb6q+tr6+T2ySwvqB3 ndzvvracd552T27YfAWeYj8W+esfTp9VL9lxHZRkLCFTMF7BKM2EGGrzL1bhTgjpnzOu HqUw== 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=X7rwb3IAzM4bniGMFK16TTs3xhsRaSA8A92Uokxj+Uk=; b=lGIzrbv0s9GlNx2ghyTHmfOJYGGAfs5R1GLjycm/ipiP52e3zLoojjkxWMkhG9D/kQ KPcvfqgVthtuIIa/zA2GzwCLuLsfbOWrEaxv/dqPRv7k1B1FYKC97gk8xkwdIKW8ALdI HIJyk8kdclBmfuJHPmEh0xF06WzhtfjUve2CefCAI2KpdtU9zqDr5o9wY5z4TQf3otrk QTTuXBTvBl2QkyQLDR4Dql0Do3xlXDPVqTplidUZlx+xXcclodp1gfwJ3xg4JodDfrTB BFzCl1swWyCnquJKh4pzrxipwceNYBWnN0qjUbpQBh0H0QRqJCfLqvFQeln1b5Hlnyal UNJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kNNmOfJr; 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 o2si3386181ilo.2.2021.07.29.06.23.22; Thu, 29 Jul 2021 06:23:33 -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=kNNmOfJr; 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 S237634AbhG2NWE (ORCPT + 99 others); Thu, 29 Jul 2021 09:22:04 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:38376 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237453AbhG2NVp (ORCPT ); Thu, 29 Jul 2021 09:21:45 -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-out1.suse.de (Postfix) with ESMTPS id 940F1223D1; Thu, 29 Jul 2021 13:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1627564901; 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=X7rwb3IAzM4bniGMFK16TTs3xhsRaSA8A92Uokxj+Uk=; b=kNNmOfJrRBJWZs26WD5Btju+nQs11uHJt1jp2ltZc3DjWwuldDCA/8hAeaiceP+LqsXmAR sdPGuzFhiD4yNxqngD7jG1C0pplL8P8MzVJNPA/s91c06KBzhQva7EFN0EhL3DdNbvh/Np FXnzAXHEJ0yXI1KoiqKUqoEicwuLsa4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1627564901; 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=X7rwb3IAzM4bniGMFK16TTs3xhsRaSA8A92Uokxj+Uk=; b=lR7fQB4KEKFyDfNYzCjyeCNXmCgcZUpjVebk1GhzQY2uGIZFNVqHm0ePiQ7t/KHYbjLTsX VwooQV5fsjMPkiAw== 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 6982113AF4; Thu, 29 Jul 2021 13:21:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gCkpGWWrAmF9AwAAMHmgww (envelope-from ); Thu, 29 Jul 2021 13:21:41 +0000 From: Vlastimil Babka To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: Mike Galbraith , Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Jann Horn , Vlastimil Babka Subject: [PATCH v3 07/35] mm, slub: extract get_partial() from new_slab_objects() Date: Thu, 29 Jul 2021 15:21:04 +0200 Message-Id: <20210729132132.19691-8-vbabka@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210729132132.19691-1-vbabka@suse.cz> References: <20210729132132.19691-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 5673bdbfc23d..09fa967519c5 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