From patchwork Sat Sep 4 10:49:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 12475529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B38B1C433FE for ; Sat, 4 Sep 2021 10:50:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6D7B6600D4 for ; Sat, 4 Sep 2021 10:50:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6D7B6600D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9C010940011; Sat, 4 Sep 2021 06:50:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE1306B0081; Sat, 4 Sep 2021 06:50:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D5B1940011; Sat, 4 Sep 2021 06:50:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id 2F980940012 for ; Sat, 4 Sep 2021 06:50:15 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CFDF218559313 for ; Sat, 4 Sep 2021 10:50:14 +0000 (UTC) X-FDA: 78549571548.40.3BC6401 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf15.hostedemail.com (Postfix) with ESMTP id 6CC3ED000096 for ; Sat, 4 Sep 2021 10:50:14 +0000 (UTC) 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 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=KDB61j03; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=rd90RmJq; dmarc=none; spf=pass (imf15.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 6CC3ED000096 X-Stat-Signature: 6gjc68aguagd988wtpwjs18go1jkfjfn X-HE-Tag: 1630752614-339263 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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) {