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 D7864C5478C for ; Fri, 23 Feb 2024 09:51:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5128B6B0072; Fri, 23 Feb 2024 04:51:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C3586B0074; Fri, 23 Feb 2024 04:51:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38A976B0078; Fri, 23 Feb 2024 04:51:20 -0500 (EST) 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 28B886B0072 for ; Fri, 23 Feb 2024 04:51:20 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C93FE4060E for ; Fri, 23 Feb 2024 09:51:19 +0000 (UTC) X-FDA: 81822600678.19.F3129A3 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf17.hostedemail.com (Postfix) with ESMTP id 4838A40012 for ; Fri, 23 Feb 2024 09:51:17 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=M4YSa6IF; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=On2E3knU; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=M4YSa6IF; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=On2E3knU; dmarc=none; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 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=1708681877; 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=95aaKSSaRKxtwQ2IqSIC0VcCKbYQQb5o0zeaoyiloIk=; b=DvGXtYoGO8ufdRoI1cL6PTTgktc7cTdm5OxxW5YBFk17Af+8lvHrVgAp9E8oJm2FPggAce yF1GTR0lwyno13bRTapoQHz1xoBamDk+73zugR/CSlq7fUl9JDXtC3BcxiwWMLRvJQ+oAP 8ueQW9arPW3/CvavMtgEVBK/1eZEIDU= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=M4YSa6IF; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=On2E3knU; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=M4YSa6IF; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=On2E3knU; dmarc=none; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708681877; a=rsa-sha256; cv=none; b=RtnNmoaW1MTOl21FV4vr3r4l6ALAXY2B2DT/sssuZ2M9tNENx91mz3T4enmwmKuDVGSm5J ARuBQ8HieH1okyQF7Xg8ulrt6Rqhdcb4P6oDypvY45Ib5t2OEaX9rnhF7TJTgzGVzoLGy8 krc5ZBHNIHvitIdFicanvU0qdFqo2EA= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8FA3A1F802; Fri, 23 Feb 2024 09:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708681875; 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=95aaKSSaRKxtwQ2IqSIC0VcCKbYQQb5o0zeaoyiloIk=; b=M4YSa6IFlafLMA0CSyenyVoqMnxVqIhLIWZZCvwtnj6AdsGgfRwv6kDBiEXWaFpUsWvkUh sCo52u6Sp3VixSYe7vhBBMpqxPa6B0vBrC9+WYlT1WbaG02okpkj44wK9viBmojJEiNa6j 2KKGDsldaWNU5DwKJ7pqz5L1GQdqu54= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708681875; 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=95aaKSSaRKxtwQ2IqSIC0VcCKbYQQb5o0zeaoyiloIk=; b=On2E3knU5hMg2UlFl1AuQigcKsbC8k0LMT6ZD7HJjJFwlUasKCbyVGAGCt0yW/yXqFp2Ri 5WFcZSeedJZW9DAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708681875; 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=95aaKSSaRKxtwQ2IqSIC0VcCKbYQQb5o0zeaoyiloIk=; b=M4YSa6IFlafLMA0CSyenyVoqMnxVqIhLIWZZCvwtnj6AdsGgfRwv6kDBiEXWaFpUsWvkUh sCo52u6Sp3VixSYe7vhBBMpqxPa6B0vBrC9+WYlT1WbaG02okpkj44wK9viBmojJEiNa6j 2KKGDsldaWNU5DwKJ7pqz5L1GQdqu54= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708681875; 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=95aaKSSaRKxtwQ2IqSIC0VcCKbYQQb5o0zeaoyiloIk=; b=On2E3knU5hMg2UlFl1AuQigcKsbC8k0LMT6ZD7HJjJFwlUasKCbyVGAGCt0yW/yXqFp2Ri 5WFcZSeedJZW9DAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 66D44132C7; Fri, 23 Feb 2024 09:51:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Vpp8GJNq2GWhTAAAD6G6ig (envelope-from ); Fri, 23 Feb 2024 09:51:15 +0000 Message-ID: <2744dd57-e76e-4d80-851a-02898f87f9be@suse.cz> Date: Fri, 23 Feb 2024 10:51:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] slub: avoid scanning all partial slabs in get_slabinfo() To: Chengming Zhou , "Christoph Lameter (Ampere)" Cc: David Rientjes , Jianfeng Wang , penberg@kernel.org, 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: <20240215211457.32172-1-jianfeng.w.wang@oracle.com> <6b58d81f-8e8f-3732-a5d4-40eece75013b@google.com> <55ccc92a-79fa-42d2-97d8-b514cf00823b@linux.dev> <6daf88a2-84c2-5ba4-853c-c38cca4a03cb@linux.com> <347b870e-a7d5-45df-84ba-4eee37b74ff6@linux.dev> <1a952209-fa22-4439-af27-bf102c7d742b@suse.cz> Content-Language: en-US From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4838A40012 X-Stat-Signature: ywoup7kyocu9w8t93htnc9hhxhui8qx9 X-Rspam-User: X-HE-Tag: 1708681877-981276 X-HE-Meta: U2FsdGVkX1+SINgu0YwNWEYiMjTseCyyT62zoz1jpUWGs5nhpnJmhzyY6JTYvFE6M65qHdf9ZxLF9rPEOohI9m5Y8V7oNANnZzxiRd39qa47QV3hfTdLB8DjiAGqCQn/RST5GtLUU2niH9jJigIjWJEFzKvmObfYafd/lEOT6TUuShe3SCp5w3VOZj3sssqqc6sLc5AAPwp1votgvJR4RUYCABtZFm4yrmSlVUEaYUfgp3sJ367OjKIyMk13VIfAwYA4PLh+VY6+/tuSjrbUQ2sb44XdMr6BIyOsE73vHsV/rJCPJnCzyZjDMg05Az3tqkX4cg8ogzgj+TJh+ADQwK6E3fW9Y4lktbJ2j6J1lH87eI6ReNOI7nIr2mPjh3vPGHq83N2KnyPS7hLjwMPy/EIr/5ciquyK6nLXYGEWCNRq+luaUKgNAejUCcGCJRt2f0RsJKEq8E2m8mHQ52rmWYAPF9o0KBLKPc2eM+ZGPD9jDNP4HiMUDXvEP1BFc4S9rcvQk2NcBpdxKiX3YKFGY+6QPTZig6zCFV784dDsA98pAb5/hByHyZcmvpIsZkaMU0IYMvf5cZg81bmjYzlfdj2mbKd4gTojO1PsbDnp06J7IdkGpUrrt8iuGkMRm8ymYubVK+fBGY1KMvbGF9IEfH2KhixVTveVXSnj9ZfJapd0yn2NQv1MlLXBa6PXP3DAMlpgM1Y7oyszRSA1GmBZynAqhyCO0bbnPzQCNLEW05SHRD0jB26mOLCqplBibL50KcET12km4HR51c/JcXcOyd3ZATCmqHm9dVMGiU5SXW+yy6TpdtN9DgH2LQyibKVEhIoqSrBWg0R9PTIDZoO3BL0SMd8sy2WTr9b8OpLKxiHreETgXrz0Th0tgNuIlE4+cRMFRaQBgSITzQkqdjABGmFwsRsTzFvWEi7buUEGiOTj3f+v/jRbvbvMD1+ULLAVYXW0IRBbuVBIB0Coefm 5Lku2F7h uLiQNr6pi6Aj0siKUOtQjwEzt4BuxMCBC2oT1rFC/qzI/s69E9GxWQrOnaIbhFTLna30yQ8Ydj21lubivECa7GUF9VGUd3YR4N2twLl5mFzdWQ+hMb56tkWeDcyWvLYBDGVBJIEvEYuDMBd6uiPunquIPoqZc81OkDAzsf4R0Dw/GTYBOuLEgK06RyoQl2eMhDHl358cK02dlTS4moz1zEWdnc9CinUxt8L3+fTG/DzvHokUuWH+dD5UM4JfXmPI2Us4+Fr/G7MVXP1B0BA1baxK0P0Qlav4rj+v6oSNZPVFTDgB+/hQ4qkIkdbKMYPurOJXKGQDhtnJ0ipfnmKfYeK6hMe2tjqwgHTe4CWyeWZafFA8NzLOWBkpAzC9DBm3pqFVL 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 2/23/24 10:37, Chengming Zhou wrote: > On 2024/2/23 17:24, Vlastimil Babka wrote: >> >>>> >>> >>> I think this is a better direction! We can use RCU list if slab can be freed by RCU. >> >> Often we remove slab from the partial list for other purposes than freeing - >> i.e. to become a cpu (partial) slab, and that can't be handled by a rcu >> callback nor can we wait a grace period in such situations. > > IMHO, only free_slab() need to use call_rcu() to delay free the slab, > other paths like taking partial slabs from node partial list don't need > to wait for RCU grace period. > > All we want is safely lockless iterate over the node partial list, right? Yes, and for that there's the "list_head slab_list", which is in union with "struct slab *next" and "int slabs" for the cpu partial list. So if we remove a slab from the partial list and rewrite the list_head for the partial list purposes, it will break the lockless iterators, right? We would have to wait a grace period between unlinking the slab from partial list (so no new iterators can reach it), and reusing the list_head (so we are sure the existing iterators stopped looking at our slab). Maybe there's more advanced rcu tricks but this is my basic understanding how this works. > Thanks.