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 84D23C4332F for ; Mon, 30 Oct 2023 16:19:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14D346B0202; Mon, 30 Oct 2023 12:19:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FE0B6B020C; Mon, 30 Oct 2023 12:19:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2F186B020D; Mon, 30 Oct 2023 12:19:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E52056B0202 for ; Mon, 30 Oct 2023 12:19:25 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BA19B4062C for ; Mon, 30 Oct 2023 16:19:25 +0000 (UTC) X-FDA: 81402637890.01.47EA16C Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf17.hostedemail.com (Postfix) with ESMTP id 6CD0540006 for ; Mon, 30 Oct 2023 16:19:23 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=YYItWmNl; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=vSXenXUT; dmarc=none; spf=pass (imf17.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=1698682763; a=rsa-sha256; cv=none; b=0zHEwG8cvosIqwEra9r0pGycNChUbzKEDZ9+8ng8o4xsZldyrkkqklOw3NR4nsGIhDOBSI 0ue5AVSbG4Z9Uy/4Qicyyr6y4gbjHyCK4nO00T4lwFQaFzc1O7GvcOFQhPSKWAh8ludSOL kNiMPWDKZZD47rC3WoGIeLbuIVixb7k= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=YYItWmNl; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=vSXenXUT; dmarc=none; spf=pass (imf17.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=1698682763; 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=65hZX46Ldjh7QmsBFkrp85EMDRFAD6ANd/SR2JZsnB8=; b=RnCAfIqkAei1r65nBNwwNpB59LU7fIW+A3S+ani7Z1I8yWgknL9f2gREr7pOog1nBPU+iH 4CP8DKzUennljYwWOWtqh3G2hAF/dLscGVpPu52DQ73Mxolw5noJ37G/RI1/DUxnPWTsp7 zNcfrDMgVsRsz941sfCoCq+D4s5BtXM= 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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6CD0540006 X-Stat-Signature: 1ipq9qfciz4dspdj6rd9zjkiubz4ta9b X-HE-Tag: 1698682763-221845 X-HE-Meta: U2FsdGVkX18vJ5BBqiRaKTWxxoOSeAkAzidq8pkpxJCugd0V0oSODF0qYZHFE/+TMpw5358JToqha+Hueay7k0v3Ovg1ojZZMbJeAuSePYwIpmhC5p4+nE8gwBwetye4FI3iloehBvp0b2ugrCMOLreHFb9c1pWa0JMbO+51betcYayzFEr/qF/5xgslTUrVBUmgmB+eRnj7rNrqMjSrfagmaj8KF5LmFrOGJLedNoMmgg0GlIFUA8L4hGjzH5yGjX9Xz+DNWSparBeMkdlVh5ziGAr4SgibXjeDKm5K4Twzbz/+3Wfg3wQ435rYfqDMPNk3LXLshgKDX3HZ+dM6hCSkGUjJ/oVitszapeoQd9JixLm3wMKyI9fdfNMXUcpWDxPeLE6vRkp7aYgFo2Z4mLoNqRIu9l8jthtnbOZf10qvf0Oz40uAe63jDJ2wCqNzFbgsgXF9Klnt2/P02eY/1f2q2o1YoTVuTma/s9XUaxsF34ZWAVUDgz3btph6gWA6pvc54XUej0T4uG+fdB1b+fsO/9R/vXsrczSpufVufxQPeN94/1gWUMaRIQmZ25HKHzQRLRl5f6UhdBhnkiHYi8qR8NFMblQOZalfi6id64IiA/3i8x4ZhQ4jVprYdnQ96WOYDV2ljPLF2W558ew/SzfvJXT0uw98PiGkz+IYWNz0cL/iDzI+v2JcnRnlSJF+4YarlWXbIFhRXmDMhnXZsYxYgKUh0noJiV7SoXDgTUJ1Ejf6JLAXudmgaaCUca2KVL4hurgSaWvpULcqZW0fUOmDEOGrqBdzBRqzf6/ZACL3NCTv7oWVBP6BunU1JjJ1OczlO5phQXQTI6b1hPoYuNNadRP5T57iBwamx3lsU6IzXMQ95ls9LG+lhoF7hDm89g63AD0+FGEK0RhLeCrcYtI/DNt7zhashEehY1ojlWTiXholNGddA1eHI+0KKkY5zSU/ibgwmaZQhnS7B/n LnXUpkGm x3+5mFR00zRbGrxT2100pwB7SOvrScj3RpnvTxiqfT3KvwJLJeHRYadYJD84Dk1CH/99fsEnrUkzJJWuzbv9WbV3MKN44NfVf89nkjtkFrOQXQKcGBdvyOzI9jVh7FQac5YQQQ16PffRMqQCBfCVbn59OosBX3KdoJf80jraL9jwGJurTh3z/xaQqv6wGf7y8VHNKUyMnhG79SHwAybG65YaYRLlvQH37oMhV7tfR556Q7rv3BHW9AFowxEZazk5NmDU/n0dCh4SejPE= 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/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!