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 78641C48BC4 for ; Fri, 23 Feb 2024 09:24:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D88AA6B006E; Fri, 23 Feb 2024 04:24:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D3BBA6B0071; Fri, 23 Feb 2024 04:24:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD9956B0075; Fri, 23 Feb 2024 04:24:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AEAB06B006E for ; Fri, 23 Feb 2024 04:24:17 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 836071C1255 for ; Fri, 23 Feb 2024 09:24:17 +0000 (UTC) X-FDA: 81822532554.03.867E2B1 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf30.hostedemail.com (Postfix) with ESMTP id 65AD080008 for ; Fri, 23 Feb 2024 09:24:14 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=HQ6TEx6P; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=HQ6TEx6P; spf=pass (imf30.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708680254; a=rsa-sha256; cv=none; b=s2WqWbeiYEDxu91hXmqY79uD92+e644EPnnCiDHuAZ/Ri7ga5gxvfdWq2oY/L8mU0hEHB1 UQkUoH/PBa6RQ+Y76YPxJyaxuLuX++DErPl6zHRQAgwKT4oNj4HpspOzykzlEyF6FLIpR0 f7iILxU82YmzWQVIFrvwg/DBahKjBDE= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=HQ6TEx6P; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=HQ6TEx6P; spf=pass (imf30.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708680254; 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=BI3PUL04AyDJ8eLPoZj8TZ5v3v4zDascbS3qGTDm8D4=; b=q9EEIRRFU4mtu+5KUWqFbqDHGzads2lX5NDk9t+xu/oJM0Nj+EzN1ugWUciANajpWHNwF1 DTUcKoyB2tR3UzILNIpIDXAlF2i0pNmedfiTfGyfrWv4MtuUWiioGuIUhDsatBH51IvhEW dFACbgVg7tZO4nFJEFPGoA5ygGhLP4s= 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-out1.suse.de (Postfix) with ESMTPS id 858CF22055; Fri, 23 Feb 2024 09:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708680252; 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=BI3PUL04AyDJ8eLPoZj8TZ5v3v4zDascbS3qGTDm8D4=; b=PhS/hbMBvnREKdhHIvVRK1rDlStl2LC2w7g5gFbs3R1CwU0qVyq0B9V6lT4zNYzOlmNpIP ITRqzZ6UfvYaghpqpjHqBTPRFB1z4GBbIr2ggKpXa8OHwGBAAzuOktz5o2jAUbT8XG29Vp /tbjJ+LNZqjjFPLxkra3qvef5i0AJ3M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708680252; 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=BI3PUL04AyDJ8eLPoZj8TZ5v3v4zDascbS3qGTDm8D4=; b=HQ6TEx6PM75XacgxB4dFIxFRF1g7/nuTmAk4ERZVWj/k+MOdY4NvPKJLQEUlTs5+BQ77CS ioeKSi5/ZgymjaCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708680252; 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=BI3PUL04AyDJ8eLPoZj8TZ5v3v4zDascbS3qGTDm8D4=; b=PhS/hbMBvnREKdhHIvVRK1rDlStl2LC2w7g5gFbs3R1CwU0qVyq0B9V6lT4zNYzOlmNpIP ITRqzZ6UfvYaghpqpjHqBTPRFB1z4GBbIr2ggKpXa8OHwGBAAzuOktz5o2jAUbT8XG29Vp /tbjJ+LNZqjjFPLxkra3qvef5i0AJ3M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708680252; 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=BI3PUL04AyDJ8eLPoZj8TZ5v3v4zDascbS3qGTDm8D4=; b=HQ6TEx6PM75XacgxB4dFIxFRF1g7/nuTmAk4ERZVWj/k+MOdY4NvPKJLQEUlTs5+BQ77CS ioeKSi5/ZgymjaCA== 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 634E8132C7; Fri, 23 Feb 2024 09:24:12 +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 r++SFzxk2GW9RQAAD6G6ig (envelope-from ); Fri, 23 Feb 2024 09:24:12 +0000 Message-ID: <1a952209-fa22-4439-af27-bf102c7d742b@suse.cz> Date: Fri, 23 Feb 2024 10:24:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] slub: avoid scanning all partial slabs in get_slabinfo() Content-Language: en-US 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> From: Vlastimil Babka In-Reply-To: <347b870e-a7d5-45df-84ba-4eee37b74ff6@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 65AD080008 X-Stat-Signature: s15tmyu7ms5xaaqa9x6n5wudk9znzb74 X-Rspam-User: X-HE-Tag: 1708680254-553603 X-HE-Meta: U2FsdGVkX190/Dd5lbFyc8UvhyrSrpkWUZ3MUPR9T4jRw6UXDhu31T+JqHMsBJm3yyD2lI8a2Ajts5zgx59CFlhWMDn1vef63JeOYad/1VUQouF4rS6VAOBxoSIC0IgTW2YWlrU51uhZ4vrHF9dIdD53F+ob+qL+/IckD1N7Lug4HI4EHcpCvGkHw+hFR8cQLl9tlEDzPFcnv0uwGrGihuDuSKljkSd1q20pbqr6BOuyokqXebCaTg9LctmhClr6rtWRd+9urWNaDBfC7Ly071nqon5G7gS9LKlPmzoo3Vpy6hB61eQjGcu/8RrJ7xFONUSwniPCWR6I/jQdApoL45tHeDsL14+5JAwPNlI8L77dl1F03j96KTepYT1FIkso79MvLlC0uZS1hx9kCqDY9IfxJK+aGE+mJqt6zw1oSjwHVa2wazcT0wHbV3qZg6Ew+OVY7R8lXp/hDZj9kVOUtsY13uI4XGOqYFXORKkRXYkjQBh/mAgGvrle2l2odabrrs5HGpBEpRd7cnqeI7+foG/OtwvWhFh0iHmRhsxlz1oJky3QfhAYIneWa9lc8dBYC21Js6uqajwbXGWWS2Sx7r4WBmxPaFjY4GYpsbYpKWh9MsPpupguu90+yq40N0XAW1LZCjjxvr6mBJFikXd2l8oDuhsS5+yA1mQ16GlUy/0fEtp61G1L8CVtC2Unm75YAbKgtaEfcsQ3EgTw2HI+EsJyh2ZbOT5j92o2VMREamYphYH+8oMwZ+Y+LEBAkm2qG75D3AyhhK0chq/wnjJ9grKZIPuXvTbCwehV4RGf/kUVdlyMBIBpFcZ+qCCDtx+v4f3nL+kYbsE3/xuM7yjUds5vGxmOVoCRTsLiHMHVdgjSJfFtuGcyeU6ydLyMSp8Y0QBKAtYA+Wnu3EDIhUN0179daLQ9/RtwNmvASlAd09xdD7Vo+8ZYaQbXy2gf3va/7JY/yICdsFJGLZbFnoB ECYe3Zq5 V4Qq9XzoHWZO7OsqHPRkFBaqbcbB95gzMvwHHSLT2EoMg8H/2nt653fAIf68xg9eE1p526MZ9LmIA83DXbXzi4Ww8wg== 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 06:00, Chengming Zhou wrote: > On 2024/2/23 11:50, Christoph Lameter (Ampere) wrote: >> On Fri, 23 Feb 2024, Chengming Zhou wrote: >> >>>> Can we guestimate the free objects based on the number of partial slabs. That number is available. >>> >>> Yeah, the number of partial slabs is easy to know, but I can't think of a way to >>> estimate the free objects, since __slab_free() is just double cmpxchg in most cases. >> >> Well a starting point may be half the objects possible in a slab page? > > Yeah, also a choice. > >> >> >>>> How accurate need the accounting be? We also have fuzzy accounting in the VM counters. >>> >>> Maybe not need to be very accurate, some delay/fuzzy should be acceptable. >>> >>> Another direction I think is that we don't distinguish slabs on cpu partial list or >>> slabs on node partial list anymore (different with current behavior). >>> >>> Now we have three scopes: >>> 1. SL_ALL: include all slabs >>> 2. SL_PARTIAL: only include partial slabs on node >>> 3. SL_CPU: only include partail slabs on cpu and the using cpu slab >>> >>> If we change SL_PARTIAL to mean all partial slabs, it maybe simpler. >> >> Thats not going to work since you would have to scan multiple lists instead of a single list. > > We have to use percpu counters if we go this way. > >> >> Another approach may be to come up with some way to scan the partial lists without taking locks. That actually would improve the performance of the allocator. It may work with a single linked lists and RCU. We often remove a slab from the middle of a partial list due to object freeing, and this means it has to be double linked, no? >> > > 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.