Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp842291rdb; Fri, 23 Feb 2024 01:24:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWSF8J16laOY3DwSyPkfUdsCA59JHN79gxu2j4RyVdUv6cK/dyVRabafPZsuEo/uJZ/p8QrZwsCFyo1KFJ7exKU+flq5AbkoxzfEDeCwQ== X-Google-Smtp-Source: AGHT+IHjTBkp8eN43bsWp1WeG8N8WXgE41gBEb1rWbIF0h+8pR+sAyGL2Vr3mrSUJnkC1BrDc8kX X-Received: by 2002:a05:620a:4052:b0:787:879d:5d33 with SMTP id i18-20020a05620a405200b00787879d5d33mr8087186qko.17.1708680262495; Fri, 23 Feb 2024 01:24:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708680262; cv=pass; d=google.com; s=arc-20160816; b=ZoxUT4gNk6nKgAJ7JbOgYeJGXYmCPJqEA/tDw7YikaaDVyeLcbvRoNYLUKmB4hHotM wyDMT117Ww3MsJVbl1mblPx5PkVQEVJrRIcAPus3WCX9V++j9u2IoY/krcJ63mTu1gve k7n5QJFaP4pYTGWajc4Fplm80deqvAZJeeSymfdStN1R1VIwAFEXtacsKLzxg1V0+W+f KN1CQ6mQR6od8SZIsZq+VZEqRpODiHdmEyoBZGmudoanZwrg+O793n/KWEiKd4bHjAtk TyWmdQa93RO68InzGn7osNeV/eVJO/Nou+DrysNRaMH5rqM+YxZQqQjS6oCVhCn0UNh6 sAhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=BI3PUL04AyDJ8eLPoZj8TZ5v3v4zDascbS3qGTDm8D4=; fh=+SBJjcBf2yAJOHTZx724I1vD/8hD6bjnk+4q+o12Ngw=; b=I+sLrAi4n2iPcxGXkJ0NT7oASu6mR9VFpbbbNvZL0oKT9NSNxpFHd1fBob890IXs/2 rFz3EtP90/WukJ50bqAQ1Skvefe6jy3WCeRk576zLy2a7yrNrU+QAvmAnv82z19F0dJR 1fhr8bWUQtSuoYq3PQzzwLdCFLpw3ZAIpTqm5Ov3HDs6VjyIeO7+37extgxKcRhPhXjV 7UpJAimF1f5ojjf5ohQxuGMe2YcPHou2/G3pge7zIfqkya326z13ATMK85HQ4gePfIbX 2Piba+kEMyB87opJil0BgRyq6skOhBGfTmA4WE8XtqLR0JSxBbtM412k3JoTIedee5+b ubNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-78003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78003-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l23-20020ac848d7000000b0042c73051388si14090584qtr.211.2024.02.23.01.24.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 01:24:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="PhS/hbMB"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-78003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78003-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 286A81C23B36 for ; Fri, 23 Feb 2024 09:24:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1785C1AAD8; Fri, 23 Feb 2024 09:24:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="PhS/hbMB"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="HQ6TEx6P"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="PhS/hbMB"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="HQ6TEx6P" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 575DD59B50 for ; Fri, 23 Feb 2024 09:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680256; cv=none; b=rQox238AhhjgYT5lBGBBSB0nr1eY0tcNPl6pZOvUxJ7Acfjy94IrdB+8K7ejiAAziCAXEqkXd2cyw3CJlsY3ZygXMqE5SQKm9HgKa3OXXxeivT5b+vy1E2xflqTbEI/MGjrmrNu/5mmLwJ/0zramMbOEaPROLHbs5jyIhsIYeqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680256; c=relaxed/simple; bh=/b/uAasNatYQkDRlPz3mGNYIuDQ6VGlg03I3StB6bnk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hCq0Lo2+qjWPnpqnUx1U//AVoVMx+higdyptsgRQzVwMWMWz1Jp3GlV+PuHrOcI4aTJIVbp7RycrfNVgWpQVZEf+1WUCMoqmDagBx26vmfTTMjnxgQXbfANzNTKw+1+WlpwpUZx+Rewv34jQ98aqt90ECkdUV2jKh1OWYv+/bNg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=PhS/hbMB; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=HQ6TEx6P; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=PhS/hbMB; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=HQ6TEx6P; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -2.79 X-Spamd-Result: default: False [-2.79 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCPT_COUNT_TWELVE(0.00)[12]; FUZZY_BLOCKED(0.00)[rspamd.com]; FREEMAIL_CC(0.00)[google.com,oracle.com,kernel.org,lge.com,linux-foundation.org,linux.dev,gmail.com,kvack.org,vger.kernel.org,bytedance.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Flag: NO 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.