Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1529374rdh; Fri, 27 Oct 2023 18:38:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzuzmRNm6pZn6XIHJMiVaaov6EvRqzE3fOwZkf6L+IBkNAviWsarTpvAEFytp7erP738r5 X-Received: by 2002:a17:902:d48e:b0:1cc:2fe6:5881 with SMTP id c14-20020a170902d48e00b001cc2fe65881mr1253893plg.64.1698457135595; Fri, 27 Oct 2023 18:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698457135; cv=none; d=google.com; s=arc-20160816; b=IZqivph0ZpgAas1+/XoufFUvHO3CXHZ1RME7rZqNhthHpGHpgjMMjD1A7jnBHOA207 r1JzuwezflfbdCJ+20tPrw4HUJqaq6h5+qjtlWRbtRmfZiMMMedYFsQwiUolos+sUova rPvIpm5YRW37XTt6WH8CPu8NX3z//lMVNcbjKFS7kHJ9uNXFoFosyhkopHSi2go6nS09 /nyi6aJuTxCvRTdzhMra1qIsziQhGOppjfaAaj61qwVnVgHEmOOkJw8+RlkNGPiHZKKC ETxG+r0MS7aY8j+alG2Puc5DBekGdFLdzFSwFOfHzA2pquRGor9vmkflQUNKSCaVzCVh R8kg== 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:mime-version:date :dkim-signature:message-id; bh=IELGD68QeWnUvOrfpqSGo2BNQPupvv5ypFkOiDnBJWQ=; fh=GByU5QLApU3jp7p0BuonIBRvwuX48GPFCOtpPTX5gno=; b=W04lTtdkh4B9RFsHYrVey7MHizLBYd+n+bkqGFK3srX+NR4j3o53K76ngLWcRKwVCw cD4fPYzsRkwUP33M/pwDSoG3XnQSvEu326mDW6sGcJOEXwXG7BTDOdw86KXQukyUxqjc 2C9b9jVC0fEUZKgxysFv/8BIXWDm/ePp7EQjw0OB/AwO2bQhr5Dkrc/OcyZeYO1CzMK6 R/ndTvSgQjFfjwqMlrQbWyyjfmE+ikZlhy9MR8YYe9+YVnrInXZojUQeSRA09A3AKmts IYZlx237gZTnKOml7LpJsN4cvBAhv3SK6XV9zACRHDpVJAQtPMKqzL7s2uGoGW5IjO1x YWBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vdsTsXrI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t2-20020a170902bc4200b001c724f99800si1860886plz.44.2023.10.27.18.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 18:38:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vdsTsXrI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0F2B38087FFE; Fri, 27 Oct 2023 18:36:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231444AbjJ1Bgk (ORCPT + 99 others); Fri, 27 Oct 2023 21:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjJ1Bgj (ORCPT ); Fri, 27 Oct 2023 21:36:39 -0400 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6514E128 for ; Fri, 27 Oct 2023 18:36:35 -0700 (PDT) Message-ID: <23f21bf1-0f27-4091-b889-bf43290fa6f3@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698456993; h=from:from:reply-to:subject:subject: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=IELGD68QeWnUvOrfpqSGo2BNQPupvv5ypFkOiDnBJWQ=; b=vdsTsXrIyli5JO7yC0/L6twGLUnDhL+qGEMALj5iryqYXHodZr/YFCP2Qr5RSlclXdm6N0 K0yHT3pifs7mjyUgVX6H6zUSHPFD/zkZ1/zKtGwpPAhI692iMnWsRdC/AVOACw+b4y9C6+ ERzZ6DkTDqUXy60eJitERlKH9si5UKU= Date: Sat, 28 Oct 2023 09:35:55 +0800 MIME-Version: 1.0 Subject: Re: [RFC PATCH v3 2/7] slub: Prepare __slab_free() for unfrozen partial slab out of node partial list Content-Language: en-US To: Vlastimil Babka , cl@linux.com, penberg@kernel.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: <20231024093345.3676493-1-chengming.zhou@linux.dev> <20231024093345.3676493-3-chengming.zhou@linux.dev> <43da5c9a-aeff-1bff-81a8-4611470c2514@suse.cz> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <43da5c9a-aeff-1bff-81a8-4611470c2514@suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 18:36:54 -0700 (PDT) On 2023/10/27 23:18, Vlastimil Babka wrote: > On 10/24/23 11:33, chengming.zhou@linux.dev wrote: >> From: Chengming Zhou >> >> Now the partial slub will be frozen when taken out of node partial list, > > partially empty slab > >> so the __slab_free() will know from "was_frozen" that the partial slab >> is not on node partial list and is used by one kmem_cache_cpu. > > ... 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 >> --- >> mm/slub.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/mm/slub.c b/mm/slub.c >> index 3fad4edca34b..f568a32d7332 100644 >> --- a/mm/slub.c >> +++ b/mm/slub.c >> @@ -3610,6 +3610,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); >> >> @@ -3657,6 +3658,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); >> } >> } >> >> @@ -3685,6 +3687,15 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab, >> return; >> } >> >> + /* >> + * This slab was partial but not on the per-node partial list, > > This slab was partially empty ... > > Otherwise LGTM! Ok, will fix. Thanks! > >> + * 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; >> >