Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1361477rda; Mon, 23 Oct 2023 10:08:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGU8ahTRGQB5PbrUxu6sHfvtJygp7hqyF6rkNPlsiq0yoEk3I3+7cv6zmftvhqRHv5Dsk6S X-Received: by 2002:a17:902:e483:b0:1ca:de25:30d1 with SMTP id i3-20020a170902e48300b001cade2530d1mr2812186ple.6.1698080908144; Mon, 23 Oct 2023 10:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698080908; cv=none; d=google.com; s=arc-20160816; b=NbUwoTVHjZEzj21k7mi2rTfOJNTIIjPhiBV9OCZj7toNyMt7T2j2pWsNhk3G1BrO8a IzVoJPmVTQ6Cjovl94JYWvN9V4qu/Wkc4mZ14o5qwI7Y/LYu7PmZJkGtk0rjgAHBmppm NkTABQ2xRbj/qod3lHgtwffNoiyHZhCOX/kyBxluu+qqk8Vf7cf0NyMBS3mQfinee8Qb WjRTk+8z+an/fGAiaONjjzceib/Y35000/CL+fpsp7T+EAuyaglYYVRfjTOGgcC05bjI +JtRqCCOgKAIsisj6KdE1RvSywqHahVZ7hypUJpKQffJUAZf2UMhFe3Jrz6F1w1ZfTm3 Zu2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=8xcDNBjPAI5YzV7DWNrYIMuejQTIM+WpmZUU+gHOF1A=; fh=MBhqu3w8XMrcKAanChucpEv+LnmtPLyDmgC2efugIzE=; b=xJ72FtlvFs7fKZkWZambCkS32OFCL+YSgejpFLzc4LoHhbfZTkooAZwejqThfo1Zi+ q9J2dNXZvmVaSsjZ2nikVPfJ7gmD3nLavcI47CkhO3nUyeAVBVY409a3ivQpI5hDcWDw Vx3s0KRBkivohGgvfR9/TMzx6OCOGUBhT5/AhrIPEEg9Ky2fWgPTfH3a9S0WWheG0Yqa xA4cXoTwOQJUfCv1WTRUd+ooecCFkOxwQkoGNhkrGCzSP805mfQA1C5Ku85l5X/laNVQ VK9yPwLZXzqbSAYH3nv0kIKoGO3OJjdSyG5sI2dhXXoy/Nxu5HRQ2qE4J1qJwG7YrYOj rkyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentwo.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id j16-20020a170902759000b001bbcddc33dasi6358388pll.180.2023.10.23.10.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 10:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentwo.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9D17D805E2F0; Mon, 23 Oct 2023 10:08:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjJWRIT (ORCPT + 99 others); Mon, 23 Oct 2023 13:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbjJWRIS (ORCPT ); Mon, 23 Oct 2023 13:08:18 -0400 X-Greylist: delayed 481 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 23 Oct 2023 10:08:14 PDT Received: from gentwo.org (gentwo.org [62.72.0.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFFA694 for ; Mon, 23 Oct 2023 10:08:14 -0700 (PDT) Received: by gentwo.org (Postfix, from userid 1003) id 5066248F4B; Mon, 23 Oct 2023 10:00:11 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 4D21248F48; Mon, 23 Oct 2023 10:00:11 -0700 (PDT) Date: Mon, 23 Oct 2023 10:00:11 -0700 (PDT) From: "Christoph Lameter (Ampere)" To: Vlastimil Babka cc: chengming.zhou@linux.dev, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, willy@infradead.org, pcc@google.com, tytso@mit.edu, maz@kernel.org, ruansy.fnst@fujitsu.com, vishal.moola@gmail.com, lrh2000@pku.edu.cn, hughd@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Chengming Zhou Subject: Re: [RFC PATCH v2 0/6] slub: Delay freezing of CPU partial slabs In-Reply-To: <4134b039-fa99-70cd-3486-3d0c7632e4a3@suse.cz> Message-ID: References: <20231021144317.3400916-1-chengming.zhou@linux.dev> <4134b039-fa99-70cd-3486-3d0c7632e4a3@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-0.8 required=5.0 tests=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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 23 Oct 2023 10:08:25 -0700 (PDT) On Mon, 23 Oct 2023, Vlastimil Babka wrote: >> >> The slab will be delay frozen when it's picked to actively use by the >> CPU, it becomes full at the same time, in which case we still need to >> rely on "frozen" bit to avoid manipulating its list. So the slab will >> be frozen only when activate use and be unfrozen only when deactivate. > > Interesting solution! I wonder if we could go a bit further and remove > acquire_slab() completely. Because AFAICS even after your changes, > acquire_slab() is still attempted including freezing the slab, which means > still doing an cmpxchg_double under the list_lock, and now also handling the > special case when it failed, but we at least filled percpu partial lists. > What if we only filled the partial list without freezing, and then froze the > first slab outside of the list_lock? > > Or more precisely, instead of returning the acquired "object" we would > return the first slab removed from partial list. I think it would simplify > the code a bit, and further reduce list_lock holding times. > > I'll also point out a few more details, but it's not a full detailed review > as the suggestion above, and another for 4/5, could mean a rather > significant change for v3. This is not that easy. The frozen bit indicates that list management does not have to be done for a slab if its processed in free. If you take a slab off the list without setting that bit then something else needs to provide the information that "frozen" provided. If the frozen bit changes can be handled in a different way than with cmpxchg then that is a good optimization. For much of the frozen handling we must be holding the node list lock anyways in order to add/remove from the list. So we already have a lock that could be used to protect flag operations.