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 12DF1C4167D for ; Wed, 1 Nov 2023 13:51:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99EA08D0063; Wed, 1 Nov 2023 09:51:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 927498D0001; Wed, 1 Nov 2023 09:51:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C8E48D0063; Wed, 1 Nov 2023 09:51:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6A4FD8D0001 for ; Wed, 1 Nov 2023 09:51:24 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 41AC0A0738 for ; Wed, 1 Nov 2023 13:51:24 +0000 (UTC) X-FDA: 81409522488.13.6F67926 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf25.hostedemail.com (Postfix) with ESMTP id 08B54A0004 for ; Wed, 1 Nov 2023 13:51:21 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=dXfhhc7C; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=N8kRpsVb; dmarc=none; spf=pass (imf25.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698846682; 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=wPjzGNA/3MlREK2koxGGUC8WANuq/K6v4Gi0jZO57T0=; b=bmGfijZTHtmqQj45/Rqzwk3fk/TS+foFMSVDl8ooKvDBORmCzAbMg6YXXlq+MnHaE2iG5m cjMmPqBpNostMTlH01RGbe6YEY3/xLTFL4mN+Vson0ifW+0Vt89b+kA0SIbWZrix4NTtnx cxlQV1ys4eFSckat8Wl6uy9oDdrXDGs= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=dXfhhc7C; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=N8kRpsVb; dmarc=none; spf=pass (imf25.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698846682; a=rsa-sha256; cv=none; b=RYxMB4YzCc/H00Oi0GdCm3AAazwkGBGOI1t7+M8f/4zFUyCJHlrtXF16rYnu840oBy+yt6 WUDRupyCCWrte08rPrrtkd0K4S/TP4cEuHBBRqeTnLjW9+UoEERB7WJISFLyDBeLQ391Qy VjaxIJiBYyXTPhP179v09u3t0xoL4yo= 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 385601F74D; Wed, 1 Nov 2023 13:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698846680; 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=wPjzGNA/3MlREK2koxGGUC8WANuq/K6v4Gi0jZO57T0=; b=dXfhhc7CzRF/LOmYXJ7j6dWdUoD9mzRp2wGbo1BAqE8fBuraMn5z9Yde70f8iV4v4/CwMB Lii171UKBa1YTWOWB97NBd4KElNHDC6cQwC1/CHSNSIjZnsqBP0AkDWCd6cQHMOr74omjP PEHHK8+7Oba5fGCO8gPRwMOLMozRIeU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698846680; 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=wPjzGNA/3MlREK2koxGGUC8WANuq/K6v4Gi0jZO57T0=; b=N8kRpsVbxzmS7LTxBPWOgkRw64wc8iGeTQxDjbA9tkKL18WUiyYq1nR/ktPuZX0uyAdyaS UBeNjqDwX2gqsXBA== 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 0157D13460; Wed, 1 Nov 2023 13:51:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ulUAO9dXQmUAegAAMHmgww (envelope-from ); Wed, 01 Nov 2023 13:51:19 +0000 Message-ID: <211ac705-5972-9b39-73f1-a608e65b6de3@suse.cz> Date: Wed, 1 Nov 2023 14:51:19 +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 v4 9/9] slub: Update frozen slabs documentations in the source Content-Language: en-US To: chengming.zhou@linux.dev, cl@linux.com, penberg@kernel.org, willy@infradead.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: <20231031140741.79387-1-chengming.zhou@linux.dev> <20231031140741.79387-10-chengming.zhou@linux.dev> From: Vlastimil Babka In-Reply-To: <20231031140741.79387-10-chengming.zhou@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 08B54A0004 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: e63yo3641786gkhdrstkdyotqz818feg X-HE-Tag: 1698846681-400235 X-HE-Meta: U2FsdGVkX18szVA0x62anFfsitBNozpb3DEEFEMRjNksyYgs+HyqVq8j6wel/H1+S///a+F92wpsSvW7Rz6M+SMg9omSfbSEwZrsS2DsA3kYv+WeJu3G1rQEDxh9Mxj+AyzvdLfDCP0y50dNkJ+XK/xLRKiiDOItLCKZt6Q5FqZ4M+BIeBB9d/eiPXDjDYGvQmgMc4ZRSskWx/A5yX10OpAdo4919OtztFxDVGFveJC1QJaMdDVWsBij/W9+9ZcNTuDgV46tQVT1a5PK32hv/lRYGMtOrXRWjqJ9o262lAsXNtvYtxy/oMdpyH6TL03xMbvRjULc132fjMhnmJRFb9qqYY1b14a+HIv1+LqtxcYTV2+pCMu5iRWTXG2W1b1JzR2pq54RUxGZ0tBSjVEBuVyI+DHO6sRKxre6Naajbo/Szjk+ebR+7urlp9laWdSE+cJHdiSYnrC/VQIb05UunB/BaOSRgEkoSEbMoNfalNLaiHrAMPzDOWG/91tFLlP9U1+47hshzShiKMRE9wb/jBzjsbHKPsJPNVaynTEqh+h/v+bXd+N/pWjFUL46IaiLdsU9PP3rlhIPPhFpNYNemKioxPvqrHDdj+JOtlpphJxqSFjxFC61JJ6ddx4SP57r/WTOxEeFNHYorprPtwePnxWzPHPlDt+09FeJGt3eXSWMTZpAArov6WjsiNBiorueCuoPeLlF74iEDKVXJVD13geqcRbmhtl/4s70/4JcSuMm+GBT7tm3xnvYKlqLnnV/N71C5HG77cQ7YQ0ET5YlbsZKtofeJGgKTU1/t9kgqv9BlHKJ8ijN/H0fQOXBzgYPjo3ODUtsNxOsjKi4M0MkCyqISjU3Go4nQaBTTMwt50R0EQ4TgveRPgTViL0rbdjJ2LeOo1UrPZDUtexrIcgVKnsCX6ee62kzsf1k8p2AoSaaaMBEZYLhzYjtBCLxtxP9B/8Mom5kBu8gXjkcj8R NYTPYEGB Ov+SHzL7piI0ovw7YcelsiiDSNMwku/HPflQcqOR6NDSEchqkYbsllvoQ+TlJrc9zEE6LYNS1H5ygjLgqJ9vVKPBLFao+DTozjGl6GKxb6gud47gQ7QfeOQQBxnLSsGkeeEBengp99Qj3OLNJPcAwVIa6EOhM+hR5KIiM5/RTRlOs6s+ro6aPLxQu9Gs5/lZcSL2vFITKdHAZLZspHAYuDtwNn3SoFYLk4amPkBJjFhJsqPORtZGJCYgGPBJMwaFc/aSOlt85rAr3nRUp9v5lAnrZOowga3IZxIxiWbp+DWRxLlOiehCyTWAoQ1F3m+JnLKJWNQl0I0h9Ibo= 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 10/31/23 15:07, chengming.zhou@linux.dev wrote: > From: Chengming Zhou > > The current updated scheme (which this series implemented) is: > - node partial slabs: PG_Workingset && !frozen > - cpu partial slabs: !PG_Workingset && !frozen > - cpu slabs: !PG_Workingset && frozen > - full slabs: !PG_Workingset && !frozen It could be useful to put this also to the initial comment description. Towards the end of the comment, there's a block explaining "slab->frozen". It could be extended to cover all 4 combination (but not all of them need such long explanation). > > The most important change is that "frozen" bit is not set for the > cpu partial slabs anymore, __slab_free() will grab node list_lock > then check by !PG_Workingset that it's not on a node partial list. > > And the "frozen" bit is still kept for the cpu slabs for performance, > since we don't need to grab node list_lock to check whether the > PG_Workingset is set or not if the "frozen" bit is set in __slab_free(). > > Update related documentations and comments in the source. > > Signed-off-by: Chengming Zhou > --- > mm/slub.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index bb7368047103..89d3f7a18a73 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -76,13 +76,22 @@ > * > * Frozen slabs > * > - * If a slab is frozen then it is exempt from list management. It is not > - * on any list except per cpu partial list. The processor that froze the > + * If a slab is frozen then it is exempt from list management. It is > + * the cpu slab which is actively allocated from by the processor that > + * froze it and it is not on any list. The processor that froze the > * slab is the one who can perform list operations on the slab. Other > * processors may put objects onto the freelist but the processor that > * froze the slab is the only one that can retrieve the objects from the > * slab's freelist. > * > + * CPU partial slabs > + * > + * The partially empty slabs cached on the CPU partial list are used > + * for performance reasons, which speeds up the allocation process. > + * These slabs are not frozen, but also exempt from list management, ^ are also (otherwise somebody could read it as "also are not") > + * by clearing the PG_workingset flag when moving out of the node > + * partial list. Please see __slab_free() for more details. > + * > * list_lock > * > * The list_lock protects the partial and full list on each node and > @@ -2620,8 +2629,7 @@ static void put_partials_cpu(struct kmem_cache *s, > } > > /* > - * Put a slab that was just frozen (in __slab_free|get_partial_node) into a > - * partial slab slot if available. > + * Put a slab into a partial slab slot if available. > * > * If we did not find a slot then simply move all the partials to the > * per node partial list.