Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1221671pxb; Sat, 4 Sep 2021 03:53:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCGJMzwXUqhG4D7V2ppT22ejGaSoOBe8MGEZ+zDMWyh5kfnux3GBQ14rgSFeqLTuM9CJQQ X-Received: by 2002:a92:c04e:: with SMTP id o14mr2161980ilf.289.1630752822187; Sat, 04 Sep 2021 03:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630752822; cv=none; d=google.com; s=arc-20160816; b=bNLNpMcBbwFmHJUGJtfmtHOujzjvdtnCy736CkvaOnjESQENi22u5yOJsi/Ny2nVml u0hsYTuLE+ZPAjSzKXTn019z+gtUNiSi4nCmHz24v3NYKmQL8Yx3lLSB1q4JHfVK5a1s H+7yY01QPl0ex3Fz90iAVXcPi8DVyllqTMeIIpH0he66PTPkvrnF2+TWMTLRTCDPSht/ yYRQUdn0al7nBEvV/JDpL6EzmTcYBDbXfkmhdQlLOZW6hbkvW47l18LLdE2WRAmD0Obh 9xco7uaCVv0/V4q60PpumqkXhHNsufvKlJNaodyI4N6JT0ibVeuOJ3zJ/EaR1vJ4B/gW JeQQ== 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=WETh2l+H2XGr/b8umJrqMOqpxk43rv6xOLKvPHqZkHM=; b=GbrSIxEvjiCKizEA6H7N1VvKeiNzK0XRgiBzXERjUbr6oB1YtXErjGU3h7n+gIOC9c MNlT1eWAeDHKZvSNT1Texi/m0n4kN6lvnzbQNBJ08QKTwAmyjE/1/Jt9JbODD5WWlroG OoosnLR6YO3chH8ftCnTzzwM+eVC8ZifBL9e9QjulR1m5yhXku2TC84wN3PX+kYBNpwl lxTveoYZRpSRSWI/OeHm7pAnlpF1vKC0g+TrOQEQaYwQPeY1J2D5wYh2EnQ659jwN/QO C5pbFs7nb8BPXzDHuq7j1g7ieC0fGKKlem08WGg4qyuUiXajGC/cgfH7e39JpsanyBxF j1dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=KDB61j03; 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 4si1711853jaj.45.2021.09.04.03.53.31; Sat, 04 Sep 2021 03:53:42 -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=KDB61j03; 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 S236301AbhIDKxQ (ORCPT + 99 others); Sat, 4 Sep 2021 06:53:16 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:41820 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351122AbhIDKvP (ORCPT ); Sat, 4 Sep 2021 06:51:15 -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 6C49120049; Sat, 4 Sep 2021 10:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1630752613; 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=WETh2l+H2XGr/b8umJrqMOqpxk43rv6xOLKvPHqZkHM=; b=KDB61j03G+46/rETq1r+jP+Mq/o3BQpmXW4CE7aiGc6HBLNbmhlshWiPm00IVb+7GEa2jf jrI9KTB2GQHvsTLbwZ0Nu0jdI4Tj06CcxhuZCtPw33a5F2Soc+flFQJ7C8+IJbkfNFxGoN cB1w3HoFoD+jOxye3PDpFZN8mFxDOtQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1630752613; 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=WETh2l+H2XGr/b8umJrqMOqpxk43rv6xOLKvPHqZkHM=; b=rd90RmJq1SjpjesM8KlUJsq8VLgoF6lAzOvc5ccLVgHSHAiYg/zaf9KLbmwWIxAH+LAf9E wOUeudzkWXYLGlDA== 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 444CD13A2C; Sat, 4 Sep 2021 10:50:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sKP2D2VPM2HoUQAAMHmgww (envelope-from ); Sat, 04 Sep 2021 10:50:13 +0000 From: Vlastimil Babka To: linux-mm@kvack.org, Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: Andrew Morton , linux-kernel@vger.kernel.org, Mike Galbraith , Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Vlastimil Babka Subject: [PATCH v6 23/33] mm, slub: detach whole partial list at once in unfreeze_partials() Date: Sat, 4 Sep 2021 12:49:53 +0200 Message-Id: <20210904105003.11688-24-vbabka@suse.cz> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210904105003.11688-1-vbabka@suse.cz> References: <20210904105003.11688-1-vbabka@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1079; h=from:subject; bh=9dO5Fy52OYg6aamf/fFyTsnxFPvKT5TUAOHnYRrwruI=; b=owEBbQGS/pANAwAIAeAhynPxiakQAcsmYgBhM09AhPTgFAr0mSp22Wz5xIepTmks6ErJbKhGBjkQ p6jEhIOJATMEAAEIAB0WIQSNS5MBqTXjGL5IXszgIcpz8YmpEAUCYTNPQAAKCRDgIcpz8YmpEKfRCA Cpi+KWCiIdcwC8RjnMcE5n6Ixidb1SFLhOW1s7Ys3mPU09kGC0bbFminQkaAE8Qt4MpB60bn/QMNiL bW/vU9AllEztwhHYcJL6jpuVacqwTm1lF+QZN6bbCx+YvfhBJWp0lzPUvkQbI01sQtyb0lVqiwnxc0 l+GRc6pJrUNZpsoYwgFLgbBq0bJ8Lty/rNU3FqzZ7Ne7TnXhXzCMua1j7D+x36LzKJm3t7pF6XqVra R9KUoebAtACLoJYQxBTvkPc95js46555o+7hcM0OFEwdC665rR4auVRbd3WLY+6r5UJjVNtneP4NFc jIIDp/IwtwQg7vdgu5c9o92Rwyf9IX X-Developer-Key: i=vbabka@suse.cz; a=openpgp; fpr=A940D434992C2E8E99103D50224FA7E7CC82A664 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 0a1e048d0db7..b31e00eb9561 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2358,16 +2358,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.33.0