Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp734888rdb; Thu, 22 Feb 2024 19:37:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXSgkWFNuZuQA6mUjSBQ9jP3uHumXAujmDeHD6fBp1MJx0fe1izKJF9fse0UQOdXB8tr3xfyYRWePXcRYKlmwiHviHYKfm5UrJKgXNSEg== X-Google-Smtp-Source: AGHT+IHMTgvnBnXy0jZjd+NRiU0InHCnXWIKpeaGZcYhp8hOL15wVvfgm5wV2YAVouZBsRgBdjM1 X-Received: by 2002:ac8:7f41:0:b0:42e:6315:2198 with SMTP id g1-20020ac87f41000000b0042e63152198mr432119qtk.50.1708659435150; Thu, 22 Feb 2024 19:37:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708659435; cv=pass; d=google.com; s=arc-20160816; b=sNoPAnY3H3uEhBB6ZI1O7VnXCFtBJ1X0pgbv6XTTupqGFz04GvNtlCHMsxipHUevHG KTXf+8NEOlMgDILftb9OzVy8us3i9wxO/kSPuXKGtH9h4ULIK0t6ztRpfdtDMXEg9sr0 5g3D8UTrPn27lqeGvyO2RitLa8Wuk4FizUX9/y9B9cvvWQzH1oC/uwAbxhqg6Xt/m4l7 xE/KBoGDPyYmGsTmUy/LNhdG6+z3RgCg610QGy71wxJeuMkZUzIW9QoxRZPKEcsd68TD SKPco3yWAjUm7HA1ppEpA8dPcQqQDK45lh/PkMFcUFyRuIWPW4cP59jY1a0LsL28PgtB rD6Q== 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:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=SL5JDmsyHyQirdU0lRKG6MlAN0ZaRI5cpkmSUjlEF9M=; fh=pMTjl89JUNsdj6JsChtd6gNMI7Wq7DO3BHiL2BED3FA=; b=NwBFWXo1mCZpRvdxiUU29UDmrAaNC046pLu5rVGhdNGca8p2lMPPdAnG070XFCrkdW 3xW04G0Jtair2A6Cz2LnL+cqzzcqXeqr5d+c4Wn1NX0M1lwYIWkDFjI3xw40OIrCBEGI MzGV9cqT6TocM+HqsgaO9ZPbJeCbcdN9PRcvfQkpCDVdWUiig1TPqqexG75F09ER9hIw 8ju9m+GtnKXqKXz2enR54TfXSvl+bO+B5rBJUfiayJQf4ubziXal4K1nFd+WP3YZCTDN Po8c7vQDtL3kC3yhECwrKl2G5TT6pXcab2/gqMx3XcwoHoOi3mVk1zpgdOCwgBRACG5i Qabg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ce5CfSyh; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-77721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g11-20020ac842cb000000b0042e24608caesi2496028qtm.654.2024.02.22.19.37.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 19:37:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ce5CfSyh; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-77721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 E13F01C23C18 for ; Fri, 23 Feb 2024 03:37:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C892BE7D; Fri, 23 Feb 2024 03:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ce5CfSyh" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34002B67F for ; Fri, 23 Feb 2024 03:37:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708659427; cv=none; b=YVcTzD+WsBw49V8x1cVOoGN8i159UeTRjTOrk7pVcOqcg8HIiDhW/IRD/kNcYuF696/GYowYJWfhdjexj/HUxwEd2U7W/uVOYMdpbiJ057ymgpuU9dNk4URqtfsjYlSGA+JRqCJiwYrCqY3uQsK/hYLl9gpHDeG8vXUe1Q07yrs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708659427; c=relaxed/simple; bh=par//A5Ss9eyZPtfnfdWP27cp3Cu9oFaavFcdrt6Ffo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jXPPSZMwu5qOZ4+LjooZPb+lYVPZEG6a/042c/9SwPDNkqLQ31m3/Q75mB5Ih7pleMwxKJ5p1BAnNTjVEU2It5EsEEY0HOayabx/6J5nIDsvhUIya9ukijmvLgQ2LyRHvBXXH6XWp3AusCT+JCwM+tjo5xU/V5yo10wUnT4t2Gc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ce5CfSyh; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708659420; h=from:from: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; bh=SL5JDmsyHyQirdU0lRKG6MlAN0ZaRI5cpkmSUjlEF9M=; b=ce5CfSyh0SuptVAvN/p/KYapS0NjlEJIZQuvwyUi33/REvbxv9IvkFjf26cFvC9uMD4FtP X3kiweqSqGZmYzeOXNdDDCznzB8TTo36TpgCXQqgqaKDy3dys1b3ljzkWsEleBIH1PB1rX koWEP+tu1VBfCBrrYq4+lGoWWembyoY= Date: Fri, 23 Feb 2024 11:36:25 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] slub: avoid scanning all partial slabs in get_slabinfo() Content-Language: en-US To: "Christoph Lameter (Ampere)" Cc: Vlastimil Babka , 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> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <6daf88a2-84c2-5ba4-853c-c38cca4a03cb@linux.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2024/2/23 11:02, Christoph Lameter (Ampere) wrote: > On Thu, 22 Feb 2024, Chengming Zhou wrote: > >> Anyway, I put the code below for discussion... > > 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. > 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. Thanks.