Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3846831pxj; Mon, 24 May 2021 16:44:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeYz03gbeob9NU9A0+A5DeeHPGAUj1A5NoZUdgi/3Jr/wgxBrvgSQuVmK3sPoua+6H/V5e X-Received: by 2002:a17:906:d922:: with SMTP id rn2mr25989058ejb.469.1621899871278; Mon, 24 May 2021 16:44:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621899871; cv=none; d=google.com; s=arc-20160816; b=L9o8ZR5/EiVoUGvjgG/d4sg8V37h4SMvVUM3AgjtnYnT6ZE/LW+unc/yD9+CuGyjgr CZDd/B/iauTjSvRd9iAVJWt+VX+oM+xDtuvaUE8wcMobgq86XVzBeNyOPHWHdAPxYsEp +qdgELHI4TFfbTLIAww0qWLnC7L6YmVVNn6333JRKsxMQ8jZr+oecVDuj9kt2uvT+VK8 OBSMOR3tfRu4Z5n89TFMGOj6j/EI7dflYMqxQCpd26zSgQqXkWOPYzwU3tATccmuo3hC 5JP++BxkWXZyqmjegLgc6RDY1iUfPxIIpa49pd3nujAkZG14UbO8eM4XAA2u91bRnf6d pDkA== 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=VR4EmJtndolGqKqcTWTo4ZFcpkqXnZ5YDlIIrHZDInI=; b=K6AblrOMaUdxD8niCStUnwqZEmPqgV0nhd56SZCUOgDvmsQYkmNDzt2nrNYE0/kpdl YXlPEyv2xbCcEwxGDwvTOeoNqfBQkL9ldoSFPVdqF3CDq5WmOSRacMfXyj7BaqLMSKgd vrXCsA+V4UbFPviHYdT6bk/QH62htaU6fI4gR6So9Q4qsHmuIZ1+PEF7yC86nftFjTAr JJ2nV76l7OPgkoXIlq7jOt7XHg3OZWTBR+L+b7wU1aC8AHPKJdC5uXMzPolpxhXV5pXl rCtH92+UFX8q+89MDfCyyFjrV8goxk/nwv09DNj/gpAu6Zt4AM+GqCETT/DEf+/c5saW AeLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kZWI+b1E; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="m+/yLb/z"; 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 q13si13380030edw.142.2021.05.24.16.44.08; Mon, 24 May 2021 16:44:31 -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=kZWI+b1E; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="m+/yLb/z"; 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 S230474AbhEXXoD (ORCPT + 99 others); Mon, 24 May 2021 19:44:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:50896 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229971AbhEXXmW (ORCPT ); Mon, 24 May 2021 19:42:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1621899649; 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=VR4EmJtndolGqKqcTWTo4ZFcpkqXnZ5YDlIIrHZDInI=; b=kZWI+b1ESLL8u+WdNjDBD+dk8GjTIxsn5QKyo0ln7dpG8Uoly83QTWBpiuLqSsNki6GZK1 9zOd1z6EntYxjFduZ+U922KbXZdAKvfFdtqa0NZGGJwPd1Q2DIfmKzwBh11EHvgAMpfe+V izYHFYxG0lu7B4atLqpdfXXT2QqV27U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1621899649; 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=VR4EmJtndolGqKqcTWTo4ZFcpkqXnZ5YDlIIrHZDInI=; b=m+/yLb/z/n/eCMCzqGyTs4jzq3hd99K6gKtIXbPN9wGkz+7j4gwcEG2kjqQ1jDLI8azzJh qjKi9j+Etnw3MXBw== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 56E11AF49; Mon, 24 May 2021 23:40:49 +0000 (UTC) From: Vlastimil Babka To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Peter Zijlstra , Jann Horn , Vlastimil Babka Subject: [RFC 21/26] mm, slub: detach whole partial list at once in unfreeze_partials() Date: Tue, 25 May 2021 01:39:41 +0200 Message-Id: <20210524233946.20352-22-vbabka@suse.cz> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524233946.20352-1-vbabka@suse.cz> References: <20210524233946.20352-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 33c3faacf7b1..414cc621d655 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2312,16 +2312,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.31.1