Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp803334pxt; Thu, 5 Aug 2021 12:04:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxutZ7aVMqRt0B/8y7TCC2jmU7CAELwLTPHzT+s1JOnUtz0EcjIU737O5SuviEvdfRYYxWa X-Received: by 2002:a05:6402:35cf:: with SMTP id z15mr8654315edc.27.1628190293738; Thu, 05 Aug 2021 12:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628190293; cv=none; d=google.com; s=arc-20160816; b=lh7s8SY7b8rQm3V9RTsVQnMSl0E5G/oP+qBoYfgTB45PLJtZdasSnqm4a5TpofNI3H i6XHax2Z5KzZT8EGjnZtuT82/BcT/0WwMOwKPTqRjBsGRL/jGpvNKFfwo6YKotWu8wJO zT8EToJ9kdUO3tMc28/Ell0TA58ByCWirO/2VdJvr1j7rfD/OYFvY0+cMozxyssO9h5n bGzk6x+YBulv6p6XhQ6spMiHoM0BAe47C69/Ml0Ic9MKXhorkBhEQhYujuvUc4OjjNnr H2k/UfgwaTf5FOuBxt+7g0Nj9fE28teK3u6JmPrd9fv93nLdcxwDeC9dmEhj/PBZkftI f2VA== 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=kaztH225Wn7qrJiwFTufe9ojID/dfd0YsuBujgpOdeQ=; b=Y7sgRdGZnyfF2Bs+Y51kXDOuCuPYccDwhz+Qx0h9fPhTyjZ9ED6qtkk+cyHlQZkd9q EXaRHnZb3kC4JZnCjAGZTlEWD8D1QsLrJp2njw0vtf3XsJzyqegovoOm5lrwznMZzC5f KaXQCe3KZv1QI5oDZi5kR8vpsF3ciPGstTUte1iNi7+eAgCaDRCfDEHsFubQw6D51SM/ LuQGqkOivsrrB//lNrbuy6VsGEsD/plxQThapwlB4+Dah+55jroLBdhg/ZIQGWC1cEvn fMDKguCC//pCFGm4YcCK96qdPQuRwC4OHWq+V2z8i6VO/0zIWj93ekBxkl138ReAv7Qk Ktjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=iqKGhJ1c; 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 p7si6674634edw.488.2021.08.05.12.04.28; Thu, 05 Aug 2021 12:04:53 -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=iqKGhJ1c; 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 S241973AbhHEPZz (ORCPT + 99 others); Thu, 5 Aug 2021 11:25:55 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:59232 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241979AbhHEPUX (ORCPT ); Thu, 5 Aug 2021 11:20:23 -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 A46EA20253; Thu, 5 Aug 2021 15:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1628176808; 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=kaztH225Wn7qrJiwFTufe9ojID/dfd0YsuBujgpOdeQ=; b=iqKGhJ1ckj3UvmTddwiJk1o8SuN9grXseM10s++hLHfkDvyWec3nQnP0xRxMzIIE5phPbK bv5skJQNU6N0edlsmEvAiat6C9wgCWUEkKs/wP01NeqoAvndUD6C03+3sbmusczQmgpPEZ 4wxu4Ox5KefM7LvjSi7DVngcuW5XhrY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1628176808; 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=kaztH225Wn7qrJiwFTufe9ojID/dfd0YsuBujgpOdeQ=; b=nTgTnNBM5Q+vqHUAoRPm6ZLNI6r7KsCKONIHpcbH8za0nM7+hjkmqZKb4BiZ/fhZFChk6t RPmPepuTLmWNx4Aw== 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 78E1F13DA8; Thu, 5 Aug 2021 15:20:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +Cj5HKgBDGFDdQAAMHmgww (envelope-from ); Thu, 05 Aug 2021 15:20:08 +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 24/35] mm, slub: detach whole partial list at once in unfreeze_partials() Date: Thu, 5 Aug 2021 17:19:49 +0200 Message-Id: <20210805152000.12817-25-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 Instead of iterating through the live percpu partial list, detach it from the kmem_cache_cpu at once. This is simpler and will allow further optimization. Signed-off-by: Vlastimil Babka --- mm/slub.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 4d60bf482735..984173ce8465 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2341,16 +2341,20 @@ static void unfreeze_partials(struct kmem_cache *s, { #ifdef CONFIG_SLUB_CPU_PARTIAL struct kmem_cache_node *n = NULL, *n2 = NULL; - struct page *page, *discard_page = NULL; + struct page *page, *partial_page, *discard_page = NULL; unsigned long flags; local_irq_save(flags); - while ((page = slub_percpu_partial(c))) { + partial_page = slub_percpu_partial(c); + c->partial = NULL; + + while (partial_page) { struct page new; struct page old; - slub_set_percpu_partial(c, page); + page = partial_page; + partial_page = page->next; n2 = get_node(s, page_to_nid(page)); if (n != n2) { -- 2.32.0