Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp906802rdb; Wed, 1 Nov 2023 06:21:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQ87MbTxWbs0xkY12onJ0QRPAtFP0eTzsVH65gFDuBowR7v1faReoz3737SzYHtkDKecO2 X-Received: by 2002:a05:6a20:7d8a:b0:171:a8bc:74b2 with SMTP id v10-20020a056a207d8a00b00171a8bc74b2mr15837924pzj.7.1698844902066; Wed, 01 Nov 2023 06:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698844902; cv=none; d=google.com; s=arc-20160816; b=DqEW8mcPnb2biXm8S10PdW/qxEMgPKbUUqQSdXxgxl0PhR8zw9L3bmfvIaDULNxext 5fzjK95+BkZs8dbY53pQTrRRX8giKUaZrLc1x+WVS664LWopJCuqYut4tYgSWt7kWSkh W6JxL8j5n9w24sH++7eqfQ/9jwaYVTKbO0oZzHhhe4OE4pqpeY4yQ6vEHgW1hNmJI1lg mrvLIrLQVliTjQzwM6WxL6yxFF7Rm84UcidT7rjsW52xq3wB03OiP3QgU1R1AUo76iT3 GghsRKT90a36T8OHFg0ptSiLt5p74vurYnaCF2BBWRruJ1GDqw6M5+vnHz22pedvh6cr rE7A== 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=ZN58lJbHenxUKwiOCOfOaIP86jpT8vhR/q8e1VR4s2s=; fh=suORmLv81bmxmsxgBYcTGwm+Eb6wK1U9HatYR2UaW3A=; b=EI7DYCxvyuRt2rC8qZ5aFEAJyZYw7oIQSBLn8+ETHj4zIbGddBOJr3obPq0TjqzQjN XQtkqcF0ClleSe2AITxqD0ZrXV6wmU7Y/4h/YY/rOLRtI3eMYYKZd9wyKzSEvYQ664+N GrCXpogHEWXckLlUiRm7lQi/S+64XP04xywUG64nU91+ddKz7dNBBThiufvDCMxaesJe mAeBeRavCU5IPWNyiNSRZJgHuSmr2QcOW+vrmntIXQidOPjvOF/NY9IjT6/teL5q/6w2 bL/CQXMy3yIQB1FmBfNtEwLzf1Sw4kYFaF2gaLjPb9ZYeHSc8VxIgO0q4FC97Gij+Wtm RrTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=gcdJnKH7; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ObKbcWpv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id l64-20020a639143000000b005898db9d676si2965343pge.260.2023.11.01.06.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:21:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=gcdJnKH7; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ObKbcWpv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 97D09807C85D; Wed, 1 Nov 2023 06:21:26 -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 S1343851AbjKANVL (ORCPT + 99 others); Wed, 1 Nov 2023 09:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343969AbjKANVJ (ORCPT ); Wed, 1 Nov 2023 09:21:09 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A84A8F4 for ; Wed, 1 Nov 2023 06:21:03 -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 65BA4215EE; Wed, 1 Nov 2023 13:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698844862; 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=ZN58lJbHenxUKwiOCOfOaIP86jpT8vhR/q8e1VR4s2s=; b=gcdJnKH7LEz0a2gzMsnBvcIbCgtD/BEuHEUtOwZC0EDBpGUgG1PGKr+/xS1GJ1v46ydD5t jDmxPIJVj9Xk6THcDcJCeXmPg4BXK4ixvpwo+Z0Ks90B2JwIMcKyIWBiCaBmfzUf1DY50Z iY1HtVzusUX1oZhUQ9i4IjJ75tJkX7c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698844862; 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=ZN58lJbHenxUKwiOCOfOaIP86jpT8vhR/q8e1VR4s2s=; b=ObKbcWpvHdQ4CXuNh9TzeHnq3+inGm1NXxv9HbCGencvVJcot937DbK+T9zZEQC/igCEmX S/yFF98WuY2eqoAQ== 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 2F2ED1348D; Wed, 1 Nov 2023 13:21:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Pv+xCr5QQmWbbAAAMHmgww (envelope-from ); Wed, 01 Nov 2023 13:21:02 +0000 Message-ID: <6041f645-a3d0-367a-8f2a-c6c5a68507ca@suse.cz> Date: Wed, 1 Nov 2023 14:21:01 +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 7/9] slub: Optimize deactivate_slab() 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-8-chengming.zhou@linux.dev> From: Vlastimil Babka In-Reply-To: <20231031140741.79387-8-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,URIBL_BLOCKED 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 06:21:26 -0700 (PDT) On 10/31/23 15:07, chengming.zhou@linux.dev wrote: > From: Chengming Zhou > > Since the introduce of unfrozen slabs on cpu partial list, we don't > need to synchronize the slab frozen state under the node list_lock. > > The caller of deactivate_slab() and the caller of __slab_free() won't > manipulate the slab list concurrently. > > So we can get node list_lock in the last stage if we really need to > manipulate the slab list in this path. > > Signed-off-by: Chengming Zhou Reviewed-by: Vlastimil Babka > --- > mm/slub.c | 76 +++++++++++++++++++------------------------------------ > 1 file changed, 26 insertions(+), 50 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index bcb5b2c4e213..c429f8baba5f 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -2468,10 +2468,8 @@ static void init_kmem_cache_cpus(struct kmem_cache *s) > static void deactivate_slab(struct kmem_cache *s, struct slab *slab, > void *freelist) > { > - enum slab_modes { M_NONE, M_PARTIAL, M_FREE, M_FULL_NOLIST }; > struct kmem_cache_node *n = get_node(s, slab_nid(slab)); > int free_delta = 0; > - enum slab_modes mode = M_NONE; > void *nextfree, *freelist_iter, *freelist_tail; > int tail = DEACTIVATE_TO_HEAD; > unsigned long flags = 0; > @@ -2512,62 +2510,40 @@ static void deactivate_slab(struct kmem_cache *s, struct slab *slab, > * > * Ensure that the slab is unfrozen while the list presence > * reflects the actual number of objects during unfreeze. I think this we can delete also these two lines. If there's no other reason for v5, I can do it when merging the series.