Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1481444rda; Mon, 23 Oct 2023 14:05:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDYE4rA8tAwN3pT1jI1TRJJ/cBkLbyNci2dckmiqVPXUKFiy8h4gJBSl5CoqQLhceZuzJ1 X-Received: by 2002:a17:903:2286:b0:1ca:296d:8ff6 with SMTP id b6-20020a170903228600b001ca296d8ff6mr9683671plh.38.1698095123470; Mon, 23 Oct 2023 14:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698095123; cv=none; d=google.com; s=arc-20160816; b=FlUeELH9/MtZRaVAk0kvR50lmG9p2ecFuradRoP+uERE2NnO/H5Cd6zh1J4mvjybpF zvpozr8RuAV/Kz7k+tT2SdhuHJxzQk1ACDcMa/KBRKj5JZkkqOXa9pocscvxJO2S3tU5 l3j6pVvnZZcNWj3Dy5F1Vqlr+XSS8a1pEbuVaS8i3N4fVqRL64/8T0fan4jvp95RlB3B Po0unMga8MeVTa6aVxIjP2UoNsmxLMBh+/yEIEZI9+3CNPGfZsmwVxtdyoMHlnk/TEWc tJH0dVIOqmjeTAtwkB7LnL5bqIpcRdOwSahRT3rLzjc2SxHLrypYHUWFJnXMbPIF6VI3 cxeg== 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=uQb/JbxDPpNJMk2Nhq42TJxAIhvF2u3rojjIB7opRp0=; fh=MBhqu3w8XMrcKAanChucpEv+LnmtPLyDmgC2efugIzE=; b=h3Eo5oAFBk3MnEt4fgi8lwFYG6m8ab14KBIbd3mO7IRebP1HBavoQ9UsuKtl+FHWWw oPDFzil6twLQSjjxRGy6mxMYnK6fpBaqlyenjkRfWbP3HpnYV3KVQexQiCNJEIb4lG+O 0KRMtYQCJBrrxrrZ5nOyCBulY3jFzpOFlQH06gCC2agpgNlwLw382pLU0uR5AtJQoi23 hAPQ38kIyMQ27UL5O9dpA0VZJ5HkeLd1dvuSbVsy7DyR7f4pSDVqTX8X1gYRWVQ2a5hz ZpST4/UUwPdsQe7Cs7YE3DKAZODmaaE9BA1JYse8YmDzW3dhHfDKuxc9aoMhL48T5I5S szwg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gentwo.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id kg16-20020a170903061000b001b84335fb90si6592050plb.286.2023.10.23.14.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 14:05:23 -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; 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=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 groat.vger.email (Postfix) with ESMTP id 338E0808D284; Mon, 23 Oct 2023 14:05:21 -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 S230197AbjJWVFO (ORCPT + 99 others); Mon, 23 Oct 2023 17:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjJWVFN (ORCPT ); Mon, 23 Oct 2023 17:05:13 -0400 X-Greylist: delayed 14699 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 23 Oct 2023 14:05:11 PDT Received: from gentwo.org (gentwo.org [IPv6:2a02:4780:10:3cd9::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D50BD9D for ; Mon, 23 Oct 2023 14:05:11 -0700 (PDT) Received: by gentwo.org (Postfix, from userid 1003) id CE28448F4B; Mon, 23 Oct 2023 14:05:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id CD53748F48; Mon, 23 Oct 2023 14:05:10 -0700 (PDT) Date: Mon, 23 Oct 2023 14:05:10 -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: 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 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]); Mon, 23 Oct 2023 14:05:21 -0700 (PDT) On Mon, 23 Oct 2023, Vlastimil Babka wrote: >> 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. > > I can see the following differences between the traditional frozen bit and > the new flag: > > frozen bit advantage: > - __slab_free() on an already-frozen slab can ignore list operations and > list_lock completely > > frozen bit disadvantage: > - acquire_slab() trying to do cmpxchg_double() under list_lock (see commit > 9b1ea29bc0d7) Ok so a slab is frozen if either of those conditions are met. That gets a bit complicated to test for. Can we just get away with the slab_node_partial flag? The advantage with the frozen state is that it can be changed with a cmpxchg together with some other values (list pointer, counter) that need updating at free and allocation. But frozen updates are rarer so maybe its worth to completely drop the frozen bit. If both need to be updates then we would have two atomic ops. One is the cmpxchg and the other the operation on the page flag.