Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2848508rdh; Mon, 30 Oct 2023 09:19:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+4XNyIApYw9MakbSa2OBNBBnKGoBm/8x0UmsTtdH3Lk+Y5ffMrm7thcggxwD2I4xfb/4z X-Received: by 2002:a17:902:db11:b0:1cc:5899:1133 with SMTP id m17-20020a170902db1100b001cc58991133mr1775660plx.53.1698682769745; Mon, 30 Oct 2023 09:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698682769; cv=none; d=google.com; s=arc-20160816; b=v6r4HUbvdOd4iupIHSuuIa3n59/QprEyDSm2COoelUTkxDajDkxnkOuaFeYSB7u6sa e8JvCcq+/eCz7WDZalNcWNsMcUUyCGOH1A5m21ghZKroMwSQlGwNUDeXfzl4WBU8P5WT FMH6goLV+oE89yTGjqpBg1S1Grp/7QgiKZE+Zzm5XQrXWga/k0N7Hl2Il6dPRPb4dLpq KihFSoSgUIGQDMgkW04cDgRbDvUyuI5TBIDCsjrX1HGeAPI7pUpw3o17i1+O/Vo1YfDt P2RNPvfVRk5eBR73kuEZD0Oe8zlNxTPnRjFScwknSRo+Ys4eGI7ZLa8QIofAbrdJpYu0 Uxcw== 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=65hZX46Ldjh7QmsBFkrp85EMDRFAD6ANd/SR2JZsnB8=; fh=NaXN5UPxBMP4sq9vewYK85PCS99/SMMy41E6rjcnjWI=; b=kk2lO2JG3nqByRGia2lzozJMoeCaqn88ADtZFxic7UzKDp683KOqSJfP0tlVLQhA25 Oz8XulGP4UPWIiEVN+yWAemuDGnWT544l+CPxL+6ZeJDyvA506ZAAuMtM3UM1N4UMAu8 RGHdXPyAxFpZk1sO/GXkEyxR6q0/m8uzHo2v1wktnR8NWox54D1ZZ70NEYCOaynWMZY9 l9q0f7zOti2dJOzvXvgsPZd6MLgcygPYP2wKGFbNRE2w6hpviPeoDAQmhKgtcOCeBJj9 iNeOB7aM7gZuah6Cglyc7Mm62HAFtqinUc5sCpba95tWS5YHJ7I6k+a1sSgmZ2GGiLWQ N0HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=YYItWmNl; dkim=neutral (no key) header.i=@suse.cz header.b=vSXenXUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k4-20020a170902d58400b001c736266dedsi5295362plh.189.2023.10.30.09.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:19:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=YYItWmNl; dkim=neutral (no key) header.i=@suse.cz header.b=vSXenXUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id E40F7807C6FF; Mon, 30 Oct 2023 09:19:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233325AbjJ3QT1 (ORCPT + 99 others); Mon, 30 Oct 2023 12:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjJ3QTZ (ORCPT ); Mon, 30 Oct 2023 12:19:25 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2484183 for ; Mon, 30 Oct 2023 09:19:22 -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 9A8D91F7AB; Mon, 30 Oct 2023 16:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698682761; 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=65hZX46Ldjh7QmsBFkrp85EMDRFAD6ANd/SR2JZsnB8=; b=YYItWmNlj7SP9sHM3ZodJJP8W9ZQJv0Za/vMl5JwLF4poelmVIwNVrvse1+kGH+cBJWyPD jE53ki2zlLkK0CT/tTMMvBUyXSr63b41coyw4Mf4Vcn31W+tfn3o9KvzycsY4IA+K37pqT gICuF+4mjGlcq6XR2gTnmrLiW/sL+Y8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698682761; 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=65hZX46Ldjh7QmsBFkrp85EMDRFAD6ANd/SR2JZsnB8=; b=vSXenXUTDOsD9EA2QUBG8rlM9M52i+HkCUmmdEgXFGSZc6Y3QevVZZ+OOC9pic17IVUWW0 pPdccO8IP3okpWBg== 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 63DF613A8C; Mon, 30 Oct 2023 16:19:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LSuqF4nXP2V5CQAAMHmgww (envelope-from ); Mon, 30 Oct 2023 16:19:21 +0000 Message-ID: <04cbf4cd-3f62-9068-b4fd-c90158f2f116@suse.cz> Date: Mon, 30 Oct 2023 17:19:21 +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 0/7] slub: Delay freezing of CPU partial slabs Content-Language: en-US To: Chengming Zhou , Christoph Lameter Cc: penberg@kernel.org, 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> <1199315b-63ce-4be4-8cde-b8b2fd29f91a@linux.dev> From: Vlastimil Babka In-Reply-To: <1199315b-63ce-4be4-8cde-b8b2fd29f91a@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 09:19:29 -0700 (PDT) On 10/28/23 04:36, Chengming Zhou wrote: >> >> >> After this patch the PG_workingset indicates the state of being on the partial lists. >> >> What does "frozen slab" then mean? The slab is being allocated from? Is that information useful or can we drop the frozen flag? > > Right, frozen slab is the cpu slab, which is being allocated from by the cpu that froze it. > > IMHO, the "frozen" bit is useful because: > > 1. PG_workingset is only useful on partial slab, which indicates the slab is on the node > partial list, so we can manipulate its list in the __slab_free() path. > > 2. But for full slab (slab->freelist == NULL), PG_workingset is not much useful, we don't > safely know whether it's used as the cpu slab or not just from this flag. So __slab_free() > still rely on the "frozen" bit to know it. Well, we could extend the meaning of PG_workingset to mean "not a cpu slab or pecpu partial slab" i.e. both on node partial list and full. However it would increase the number of cases where __slab_free() has to lock the list_lock and check the PG_working set. "slab->freelist == NULL" might happen often exactly because the freelist became cpu freelist. > 3. And the maintaining of "frozen" has no extra cost now, since it's changed together with "freelist" > and other counter using cmpxchg, we already have the cmpxchg when start to use a slab as the cpu slab. And together with this point, I don't see a reason to drop the frozen bit. It's still useful for cpu slabs. It just wasn't the best possible solution for percpu partial slabs. > Maybe I missed something, I don't know how to drop the frozen flag. Should be possible, but not worth it IMHO. >> >> Update the definition? >> > > Ok, will add a cleanup patch to update. > > Thanks!