Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp125622rdb; Tue, 31 Oct 2023 02:50:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrilFD1DGdxi4UGMY+uyGNhCPsQrNLAtWoT6TQaO61i19s0tjds4kjotzEcW4wx+B+stpZ X-Received: by 2002:a05:6358:e488:b0:168:e98e:7c21 with SMTP id by8-20020a056358e48800b00168e98e7c21mr16369789rwb.24.1698745831758; Tue, 31 Oct 2023 02:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698745831; cv=none; d=google.com; s=arc-20160816; b=TcYYRbDxoAsMPrkAB6gwBy/PAl2xNlp3JjQkbQuTvPvftWewkWWFk8ONp5gQR+atiB y1kcWO6VflTBxfTPLJDQK0/EAjDnRiwU4rau2W6i4khEDHo6/5OQ5Q7a2cNHuJnIda4x 6uZhEuaVjnVxNDqIoXjYwecXs/6ArVbpHbNnGmY4RIe1/quyPhUehLWKnzotTVnzlFe+ 98G9C3Is2AtJn/QUBnd6XJp8s4Ec0S4eD9SkwjLhYf9X+CLzUQj3wYxbBTbFZcP+V7zn JW6MmBj8YI73OYiYcC1iMPshofQLU83njKokqoera3Aw1kwQByks4rfAdtoJI1R1ky5k Y4Ww== 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=wmDB3ZoDEHTn9+Fzo12LCAKVuElxwSgtEkkn5Gsrlpw=; fh=1dQjqMUTvvD26NH9CfxdSSnKd3i2/7wAguBb1AyGjPU=; b=UCxP0Xqd4dRSwxtjJmvreo7zvIY/S71NoTYwaArbDZ8lIJh3m/C9USxeonSIIrtxtT 9J1khvCWsB0O9/4crxA+GDFKRqejVuRKK/ubqoWFt5mLDA7gfjIZgctNR+/uNwAQubSJ gAIbj/wNKK7sDXHmGAygkvNBfs5KE/HsqH0ihrjudC070ys8R5jQOlxrudycXX8pJpw9 v3nOnItKz0uv5uoMqw3pSFIlD0K6k8FHe4xW2lyuUHjT+47qa+XXS8d4oEn/nj1Q8/DT wzj/YUBfQh0KmyE9aBl1jlTtT0+gXPIIa1rGAddZTtPMA/Xtj89hB2fc+40vKwznl5/C t2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ozFrpdZd; 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:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e15-20020a65688f000000b0058986c61bb6si810966pgt.706.2023.10.31.02.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 02:50:31 -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=@suse.cz header.s=susede2_rsa header.b=ozFrpdZd; 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:5 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 groat.vger.email (Postfix) with ESMTP id A989480A802B; Tue, 31 Oct 2023 02:50:28 -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 S232971AbjJaJuX (ORCPT + 99 others); Tue, 31 Oct 2023 05:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230457AbjJaJuW (ORCPT ); Tue, 31 Oct 2023 05:50:22 -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 3B1BEC2 for ; Tue, 31 Oct 2023 02:50:19 -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 C8CC81F38C; Tue, 31 Oct 2023 09:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698745817; 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=wmDB3ZoDEHTn9+Fzo12LCAKVuElxwSgtEkkn5Gsrlpw=; b=ozFrpdZdqvIodxUouCteImh+vwVdBdUAjxTpTMC6G44Bm+oX2sK6BFcCxHxb/QrLkj5fvL IRBMj3aughr2iO67uezAtmzahtbNf4hd6q9f02wrxIBrcoSvbbuVxq2Bhn3kd44Z+89B5l liHbRUYYQj1UvAbGByn5F8nbjqtR5/Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698745817; 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=wmDB3ZoDEHTn9+Fzo12LCAKVuElxwSgtEkkn5Gsrlpw=; b=nRTQoFQCzDbSNuEj/BqAmcyG++PhOUY388ZS85rAY0YlzAlYmN/jAHTtjy7lLOGSSQUbbG PaWn7jR/4rYR+fCQ== 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 95104138EF; Tue, 31 Oct 2023 09:50:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id A1WVI9nNQGW4bwAAMHmgww (envelope-from ); Tue, 31 Oct 2023 09:50:17 +0000 Message-ID: <6257318a-3d39-ccdf-a85f-dc1008a8f425@suse.cz> Date: Tue, 31 Oct 2023 10:50:17 +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 v3 6/7] slub: Delay freezing of partial slabs 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-7-chengming.zhou@linux.dev> From: Vlastimil Babka In-Reply-To: <20231024093345.3676493-7-chengming.zhou@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 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 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]); Tue, 31 Oct 2023 02:50:28 -0700 (PDT) On 10/24/23 11:33, chengming.zhou@linux.dev wrote: > From: Chengming Zhou > > Now we will freeze slabs when moving them out of node partial list to > cpu partial list, this method needs two cmpxchg_double operations: > > 1. freeze slab (acquire_slab()) under the node list_lock > 2. get_freelist() when pick used in ___slab_alloc() > > Actually we don't need to freeze when moving slabs out of node partial > list, we can delay freezing to when use slab freelist in ___slab_alloc(), > so we can save one cmpxchg_double(). > > And there are other good points: > - The moving of slabs between node partial list and cpu partial list > becomes simpler, since we don't need to freeze or unfreeze at all. > > - The node list_lock contention would be less, since we don't need to > freeze any slab under the node list_lock. > > We can achieve this because there is no concurrent path would manipulate > the partial slab list except the __slab_free() path, which is serialized > now. "which is now serialized by slab_test_node_partial() under the list_lock." ? > Since the slab returned by get_partial() interfaces is not frozen anymore > and no freelist in the partial_context, so we need to use the introduced ^ is returned in > freeze_slab() to freeze it and get its freelist. > > Similarly, the slabs on the CPU partial list are not frozen anymore, > we need to freeze_slab() on it before use. We can now delete acquire_slab() as it became unused. > Signed-off-by: Chengming Zhou With the fixup for CONFIG_SLUB_CPU_PARTIAL you mentioned, Reviewed-by: Vlastimil Babka Also agreed with followup patch to rename unfreeze_partials(). Thanks!