Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1235576rdh; Fri, 27 Oct 2023 08:19:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCTZZ50+4O9yzp/TmE1L359B6YmW2rXMpNcye+6TmTW4XZJiIAqplbsExH4ctpZdh/NfA1 X-Received: by 2002:a05:6808:1892:b0:3b2:f275:18a8 with SMTP id bi18-20020a056808189200b003b2f27518a8mr3639925oib.22.1698419954837; Fri, 27 Oct 2023 08:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698419954; cv=none; d=google.com; s=arc-20160816; b=PBl+T+5dr1VmgA4bmeera44S6FD6SO0X9mlpYONwQzYQP0D2ZW4HDmg6KAoH5mt5Ej TO2v9iARyiG9sTL9A20pLX94Afkfd9NVD1KZazlr21rFfayMWYcN3a+n2oKue5S1GsyP oyO5dsG6w2JeFlfI2yLnaTXMqf8l2Gu6UCILe4KjlZiU9nqJRAJi9GFHArx7+CtyRdIO iDcTwZHiSt1Heu16P5ptW4AlROW9fk7vLDqSJPJe/pSyHe5ONijqHd6tNzm71m8EQDak Sad/SGPKQhSjDr+F4TprhQLU6YesgtTaOJiTX9kVr5j27jie5VBhI152JG86G4BZS5Wi 5hWA== 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=HwE0ZStLbRjJE3iyZ3Dw9rRbnaHu1wJnEb27z8r+e8g=; fh=1dQjqMUTvvD26NH9CfxdSSnKd3i2/7wAguBb1AyGjPU=; b=FOA7T+ah3/LbJaecUDWP7Y5DB0w48znv1hb2QQa2iCaywIme519p1HjrZQ5Ket2+IA ac9EXwDtXXVVMI6OIw1beYM5XaEI0oSyI/UsNTqN5m9QR8RBKEjYFHakb74Qh3laGoxu NtD8H4fMYJV98++icoxi3AkpiLsrvhWiVknWo65E0XjYSH38roT9xlcbvvYraZDZT2bz L8zMSkRogK3BzfZVipmN/cNa8fIq93ziGFD2ao7UO1H+9G70PosHGMkLON3WfvKLsQg3 jBQVafDnBBwvFfOV67jR4jI4NmRlrqOezKuBI76SAX7eXcrKz/croMbcjUdyaAQ+YM5e lfKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=li6hS+hf; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=EJbqdv8c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 66-20020a250f45000000b00d9ac5356738si2725640ybp.184.2023.10.27.08.19.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 08:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=li6hS+hf; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=EJbqdv8c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 586E083731B3; Fri, 27 Oct 2023 08:19:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346304AbjJ0PSq (ORCPT + 99 others); Fri, 27 Oct 2023 11:18:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346302AbjJ0PSp (ORCPT ); Fri, 27 Oct 2023 11:18:45 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E87E11A1 for ; Fri, 27 Oct 2023 08:18:42 -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-out2.suse.de (Postfix) with ESMTPS id 066E11FDF3; Fri, 27 Oct 2023 15:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698419921; 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=HwE0ZStLbRjJE3iyZ3Dw9rRbnaHu1wJnEb27z8r+e8g=; b=li6hS+hfRz7Md7RFzXZkF44zwzsgtbfG1OtiRFY+fFg2WHQ+P6qAX7HfJ9zyJ3i8Do+0WU zbteD2Uv8Z6F5tF74TiqJuYNJ0mzYBs61h54Vi1i7U8c1W1EMdAV8MpDBv5g8VFzoYIZCM adfFsX5llVCrrEk4+bzRZvWuH4I4e9c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698419921; 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=HwE0ZStLbRjJE3iyZ3Dw9rRbnaHu1wJnEb27z8r+e8g=; b=EJbqdv8ckiwAt86OBzUyILHLHy5BXniL9i7FmKBNNxUQ2/G/pOX/dVMEwcjZfv8qFegO4h QDI1secq6EMG/HAg== 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 C23051358C; Fri, 27 Oct 2023 15:18:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id fWO3LtDUO2WTFgAAMHmgww (envelope-from ); Fri, 27 Oct 2023 15:18:40 +0000 Message-ID: <43da5c9a-aeff-1bff-81a8-4611470c2514@suse.cz> Date: Fri, 27 Oct 2023 17:18:40 +0200 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 v3 2/7] 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 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> From: Vlastimil Babka In-Reply-To: <20231024093345.3676493-3-chengming.zhou@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -5.60 X-Spamd-Result: default: False [-5.60 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_CC(0.00)[google.com,lge.com,linux-foundation.org,linux.dev,gmail.com,kvack.org,vger.kernel.org,bytedance.com]; BAYES_HAM(-3.00)[100.00%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-4.2 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Fri, 27 Oct 2023 08:19:04 -0700 (PDT) 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! > + * 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; >