Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp868077rdb; Wed, 1 Nov 2023 05:26:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHC4qhGakGvSpbipQMjsGXYkC6sZuyipO09r0yOwvVS6/O0s6IZ39EZamVax3smve1jT10d X-Received: by 2002:a05:6a21:3e0d:b0:181:671f:446c with SMTP id bk13-20020a056a213e0d00b00181671f446cmr772351pzc.58.1698841587903; Wed, 01 Nov 2023 05:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698841587; cv=none; d=google.com; s=arc-20160816; b=prXVbK7vQnu9H0BCrNp2euL0dmcAKPGIfX366PmRQCj61oAIRpPZjoVW/uIqYMtEDH Py5ZXzbFYymrQosiOswav7R8twvyxb4/YWjHRJU2zKf0b2oP4iFiP7wcba4fKN452D03 HjJ0HFc0s6X8/0i5ol9tH+1F5C7udNIGguAx7rKmP2wVQxLZkB8NEcncwv6etvIMy/x8 0oRebAB4ATYc7D66FZQEIh9lEFf/gMD9kB5SkpG0Xz5zwynlpmRGfutzr/6cv4F3GQLf aPejbkuu0idpGY8V80A4BAvXmwHfn5Pqumioy2EJHCrYpkpjhEqA15erYHnomn6kF+Z4 xqFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=TUDrsMocEffzwnmx5bQlZdnvq/xccGqkwAx5KwE/vNA=; fh=suORmLv81bmxmsxgBYcTGwm+Eb6wK1U9HatYR2UaW3A=; b=bCWbPidtdDOmseIPaXTFzoMBLoTJpNyabQ/H2e2B1CpBoBDOoC1ozlHIz19rMQGEp8 QpNkI7xKsoe7J+ppUjhO3jeolFTJLaeYlqr2Ad0CNGZZYNdlK1nVSd0+lsRo7V0wgRS1 rJAgnJBJQKelPWBRV2qN6PQXHpIWh1/3iU+bG9l0UFtZE9IDIZZV1MiJYOoLZZEqPH6Q S1if1sSOaHUwPzpvBwXzNIDQxpZjeQhur7TMv5yICKXXZaROeS2rh4oSkPkBbiubEngx Y+b57cSqCZ1dTe4K79b+o4/zdP+kuDuFqF12vHIGzKIDL2FhnftbAd3Q3bgiU5re/ebv EZbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QPyeegkE; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ms20-20020a17090b235400b002791b907f0csi715686pjb.121.2023.11.01.05.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 05:26:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QPyeegkE; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DCFBC809EE22; Wed, 1 Nov 2023 05:26:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235139AbjKAM0K (ORCPT + 99 others); Wed, 1 Nov 2023 08:26:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbjKAM0J (ORCPT ); Wed, 1 Nov 2023 08:26:09 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F5B1102 for ; Wed, 1 Nov 2023 05:26:04 -0700 (PDT) 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 B769821863; Wed, 1 Nov 2023 12:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698841562; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TUDrsMocEffzwnmx5bQlZdnvq/xccGqkwAx5KwE/vNA=; b=QPyeegkEcQzdWmPyYP3kEtonuYQmNOrYKOj60q/jHJfKaeiIj+6Cqy1sU5SX8TvyD9Z7kn 4BZmBNL3+S4lPjwXrfLKJ6Zd2ixHqeQu0E/tyMnEQXToQKf9tGfUbfao9Jco7+CMW919mh uFiFuNMKgJX3TNJCVatb/lbpfwlZBOc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698841562; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TUDrsMocEffzwnmx5bQlZdnvq/xccGqkwAx5KwE/vNA=; b=cewjfxX7vl0kIVmAcly/wWqljb/CKYkRVCE8YP1a+MObpbc4CutcmOJWm94JIYkXMCCltV XBJAEOwF+lz/ukAw== 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 7A8661348D; Wed, 1 Nov 2023 12:26:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ydyXHNpDQmXsUwAAMHmgww (envelope-from ); Wed, 01 Nov 2023 12:26:02 +0000 Message-ID: <426b5c90-8da1-831c-5f9a-fd1fd26fcafc@suse.cz> Date: Wed, 1 Nov 2023 13:26:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFC PATCH v4 4/9] slub: Prepare __slab_free() for unfrozen partial slab out of node partial list Content-Language: en-US To: chengming.zhou@linux.dev, cl@linux.com, penberg@kernel.org, willy@infradead.org Cc: rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou References: <20231031140741.79387-1-chengming.zhou@linux.dev> <20231031140741.79387-5-chengming.zhou@linux.dev> From: Vlastimil Babka In-Reply-To: <20231031140741.79387-5-chengming.zhou@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 01 Nov 2023 05:26:22 -0700 (PDT) On 10/31/23 15:07, chengming.zhou@linux.dev wrote: > From: Chengming Zhou > > Now the partially empty slub will be frozen when taken out of node partial > list, so the __slab_free() will know from "was_frozen" that the partially > empty slab is not on node partial list and is a cpu or cpu partial slab > of some cpu. > > But we will change this, make partial slabs leave the node partial list > with unfrozen state, so we need to change __slab_free() to use the new > slab_test_node_partial() we just introduced. > > Signed-off-by: Chengming Zhou Reviewed-by: Vlastimil Babka > --- > mm/slub.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/mm/slub.c b/mm/slub.c > index eed8ae0dbaf9..1880b483350e 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -3631,6 +3631,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab, > unsigned long counters; > struct kmem_cache_node *n = NULL; > unsigned long flags; > + bool on_node_partial; > > stat(s, FREE_SLOWPATH); > > @@ -3678,6 +3679,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab, > */ > spin_lock_irqsave(&n->list_lock, flags); > > + on_node_partial = slab_test_node_partial(slab); > } > } > > @@ -3706,6 +3708,15 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab, > return; > } > > + /* > + * This slab was partially empty but not on the per-node partial list, > + * in which case we shouldn't manipulate its list, just return. > + */ > + if (prior && !on_node_partial) { > + spin_unlock_irqrestore(&n->list_lock, flags); > + return; > + } > + > if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) > goto slab_empty; >