Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6094610pxv; Thu, 29 Jul 2021 06:24:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV3e13K4ekeiK7+2juveaRqz3OVrG1PBNef8AJD4mWQmepM7LQ6jykBNcKRBvwzVwmY3Qj X-Received: by 2002:a05:6e02:1849:: with SMTP id b9mr3923257ilv.88.1627565094652; Thu, 29 Jul 2021 06:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627565094; cv=none; d=google.com; s=arc-20160816; b=m9d0a2PL0lToTbMKuVbNFpiAPV22N9Tt9b+41vTymufQLdt9FGGzBwdpE670yGwetZ x7dBoOfmOyz5HUXBZI0lOCE27hcrP630lZx7G7NoVyxqlrmCN2pveHi1iY0Th95XBETk 3WJ2WWmMXznAK+oWHYlI+kIEKHikpQPCd3SyhgLrbqXbRDLOuZ9of96O2Wq2mKeH2GOe EQFwEsAYokkPOH/NrOJwT1w2BUhtkWpIbQuQH0wvo2J0DCWKX9FvrZMgiU6bySdL2Wrj ZTQe6JpLMCaNqV+ALAo6CXTFYw7apk8yQyQV6bB67XseE8Yn+z9tEzX4pnuC7KrsT1gN lc6g== 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=3cjwmH+h7UZgVKoLIxc11sR+eEh/ecP/VGvwRFBqOtQ=; b=TSB3FldM3s2zzyplgjYVMiCtNi3+cvJjEZx1UL83DMO7+gT5UWTywB9//IiHw3vQex 0AADe6AlLYAAs9eaSPaqMjY4A8CgF3I+YG9BnMCpbsCldzS33rCOECis+SPY27E/1SPH VkJ4Xc8tO9vOaL38oTqFbXZWibn5Cemyi1+vDVpcee1UGzSZTM96QpCRUIT+y8wGsOVp G/tg14bZvYTGg0DIQvblaKYa6/0jGvLCSFS1D0JE3Snf11N8nUakcIi9+d6wrCEaxvwL U9am818cXQRgU8IhDcEZcBQXRV5S0NbdY0uffa8m3vAw56o6gLO5V0MCVTBezJMWmiMJ M6/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=RS2AZZ3G; dkim=neutral (no key) header.i=@suse.cz header.b=fBJtbTP1; 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 v10si3018975ilh.117.2021.07.29.06.24.43; Thu, 29 Jul 2021 06:24:54 -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=RS2AZZ3G; dkim=neutral (no key) header.i=@suse.cz header.b=fBJtbTP1; 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 S237763AbhG2NXq (ORCPT + 99 others); Thu, 29 Jul 2021 09:23:46 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:38396 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237525AbhG2NVs (ORCPT ); Thu, 29 Jul 2021 09:21:48 -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 EA589223DC; Thu, 29 Jul 2021 13:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1627564904; 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=3cjwmH+h7UZgVKoLIxc11sR+eEh/ecP/VGvwRFBqOtQ=; b=RS2AZZ3GKGHTEIsTEdTEYsudOjTlIYo14TUkA0dNuxFKDzRppnpFFd9RMPfxe4pWdyY/05 8gH3sOJb5QKAsqECjm8y0e0P88ifGrqRUyxgyRVcwVM1l6teoGtE/fXX3Vi0U/Fxz19XTO GaSMXXMIUOJ/tsgOYrGpX0w+ClnNDSg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1627564904; 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=3cjwmH+h7UZgVKoLIxc11sR+eEh/ecP/VGvwRFBqOtQ=; b=fBJtbTP1Ja/4JF1ggTG8CxVPGmyaAd80xH84isn04JzWeYdjP2H6/FsFMCnKvXLo7LkgS2 WTMc2r4kk1IcY8Cg== 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 C113C13AE9; Thu, 29 Jul 2021 13:21:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CFugLmirAmF9AwAAMHmgww (envelope-from ); Thu, 29 Jul 2021 13:21:44 +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 24/35] mm, slub: detach whole partial list at once in unfreeze_partials() Date: Thu, 29 Jul 2021 15:21:21 +0200 Message-Id: <20210729132132.19691-25-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 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 1bde537a13b0..ede93f61651a 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