From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07B3CC4332F for ; Tue, 31 Oct 2023 02:30:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EAB76B0285; Mon, 30 Oct 2023 22:30:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 899586B0287; Mon, 30 Oct 2023 22:30:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 788A96B028A; Mon, 30 Oct 2023 22:30:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6633F6B0285 for ; Mon, 30 Oct 2023 22:30:29 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 44901C0387 for ; Tue, 31 Oct 2023 02:30:29 +0000 (UTC) X-FDA: 81404177778.27.12FB671 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) by imf24.hostedemail.com (Postfix) with ESMTP id 56A02180023 for ; Tue, 31 Oct 2023 02:30:27 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=hRg+Yo3Y; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf24.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.182 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698719427; a=rsa-sha256; cv=none; b=j7+mRtHWX1QkzO6wphBvAUXr7PF35e8T+Z0OASgQaGb44D3BvJbpfDootGAC3ITxY7cw1d A+vGxyH3Yt0h0wgWhBliSrI19xne6Jv0wTQ/oYrAwozZR4Zq6PI8DWupvmCwA1h2BsoAxw ZuzIz6gr3G2I4vs95ES8w6kNetQ+Cxo= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=hRg+Yo3Y; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf24.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.182 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698719427; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=s3D3NG9Rr5nexXkejnTZubHojYTPIvCsAncG92DOezQ=; b=OzJ5sChaZHCcAPUEmezG97lZXC79Td+gzAYt3Th+yEQiU1KBwHJCl0S93KFuvEfzKhK7GR kz1LLPvZo8qWKLuWNeimCUZ2P6mbG67Xu37g2xw9eJ8M6hEiGV1dZc2aT3iQdNxFf2HPlt qJbrZCECxlOh0l4gkfX8Zje4Fcn2zNM= Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698719425; h=from:from:reply-to:subject:subject: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=s3D3NG9Rr5nexXkejnTZubHojYTPIvCsAncG92DOezQ=; b=hRg+Yo3YilYdpwUOalAS1b9MuHcI/s8JdbFEwfZhaStPXBmmwzD67ar2kTezMVGcTXLIPj b+1e0sKFI01VF3F2XWYKdtstzZhrIXy6Zz664pEHQirjdclh2ZnSJBEP/e1aTLbhmM5LbC 8YRGA4xKKwn4RKT72ZUnyxREve+V54w= Date: Tue, 31 Oct 2023 10:29:53 +0800 MIME-Version: 1.0 Subject: Re: [RFC PATCH v3 0/7] slub: Delay freezing of CPU partial slabs Content-Language: en-US To: Vlastimil Babka , 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> <04cbf4cd-3f62-9068-b4fd-c90158f2f116@suse.cz> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <04cbf4cd-3f62-9068-b4fd-c90158f2f116@suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 56A02180023 X-Stat-Signature: 131byxurd4iczyuc9numcc6b56s5zptm X-HE-Tag: 1698719427-621269 X-HE-Meta: U2FsdGVkX1/J++zHoAqp/b/oipi+p9+2EC5cPyLFRnd/qC8X8i5wqbfKgzl5p14WAKjtmCMy+oVs3H52FMS7XYgZsZdwCfVlOy/20xVoT/QSJREbo5ItfdOhwsJdJWc8joGsvononen/UzFZJ2CeS7yP+byRr5NaHyNKQraW5Sn+/dQmTjLf/DTddupyoArv9CLgRGKED3QeO3tvhPodgHJiffKLlCRuUVms1Za7C9PJFdflnIeEgLYaVhDrnw4ynjLK6Rr08A4T3JggckppLq+q+cpyJbpzdTCQPCRjIKXW1hR8yVYQ/2CqMip47yT/B92q1g4emHAje0sUe4l/Leou0awovR4hwi0cWP/Dkijy1muIuitT7Dy6rsTIsydOu5iQtprDgaF6uE/I6zHpqvlNXqf1tUd5N3tsOsPL7ROiMq9S44WzGJ9PhX4AGj6j0a9qQ8s+BfZqTW6UtysyDI9hcIHW5HqpkR2KgNvyXm+CS+V7Lu/f9LziNn8v3RlGTpdOcEa9i06miCVrpMWhhpIXiIXHfZ5x6wLpE+Cks6ty89SHh4IZjdoF6i/EZkusgfZ9h3Hrh9auG+zz4ivP8tjza6IYuzPvvHstunKm8Mk3TuF4tnFrB5kbIcKa4q8HR+nq0oicChPpJDousJbgK6qPuDkT33bNtwhnXm+xHHi1s0UDWTUt1lPcdOw2fS7a7reyBBQY0nS0PSXV675XgRLzOprS+LhgtUchwAWn3Ou23Il/+f3vrC/bJ27yZr64bLZxdb+MbXJOQ7rjmlyG7wJshQmWV9ofrMfuJEKFNbszirebW3wtfEL79hgDrW9SB4Aw+l+21MnsSIPdSbB7netmrM5Eq8dhjQUQAbU5cgqrumONZSctXQiqFWqCl01XbbhijfPwE6Hjkratxl/apxJUSXIpM3UOpJ73rd8Bf9xYv9II9WZF0iGnq2/joAHBC+IOoK/FQDTAfobwqF5 /JIL5mr/ 1krPukmfRxiPeFuddaGKE46nU9psBh9Sz909zK4PwafJr7qRwf3SBv4EqMIO4b/TcSoEzJK6jyXPA2IioVwn/yRjdCV+mdl+J1KkDliR9I5IaD+NaIWfX5D2pbKOh/kf9eoZw3KhPVDZfhfs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2023/10/31 00:19, Vlastimil Babka wrote: > 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. Ah, right, it's possible to do like this. > >> 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. Agree, we'll just keep "frozen" for the cpu slabs. Thanks!