Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp90675lqp; Fri, 12 Apr 2024 11:16:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPbyTAl5bq14kJmciZJ8+PiWQccw8A6Cm+p2e9o8CyllnIZnVs7CFUlba57dytblTIpWFLrUXtFgQCav2kQPVMLeIDvbXuTVmLYNt9pg== X-Google-Smtp-Source: AGHT+IHOLYvT8F71yt11hQAWwLJiIAeu1OUxg8x+kVcA8HPL+f/+NXwu/5+wwPAac4jWMnwJquMY X-Received: by 2002:a05:6830:3483:b0:6eb:5b4a:867f with SMTP id c3-20020a056830348300b006eb5b4a867fmr4494176otu.22.1712945791646; Fri, 12 Apr 2024 11:16:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712945791; cv=pass; d=google.com; s=arc-20160816; b=iB8OIdKTTV7Ya6NpdR+FHnN7I3xTzFDTMJITIp7OZSqYDxqKvRkLTcXxIHRXq7rbL8 TR8BhbJIRphMSuDT3ppRSn9+L7M51Xf7GpdbfM2juJGd+pwJxQl1mGEYpQWsHuQGOhnI LiOepSJB/TJfgI7ctBFJagbckxPknBOun9hzeTD1/knxppzwlaHU1ZSfNB03m0oZhLuD Gr89jWtsr694lOZX+0lAc49r/Uw2iFwZ6BGsxhfhDhPNSaa73rdCT56kPCgnwF5ABKtw t0IXpuBsJt71za8m9AE9iRjQesn1VrKyd1E/cpUVn24bd3SkVmQ8OJQm4KTnSTTzhxXO 8ZlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date; bh=TXudRz4hhYnCxOpofreETA4x+N18YNPDltFINFXPF5g=; fh=ATgWtFvnCD58+L5m6r/GICJDOqOoP7YgwMLw/c5fNTU=; b=rUmFnY0e3jedMZdbQ5C+w5pbrLCbdTw5hiUgSaCTnRGrcjSM7UUQ+t0AIrVxhIuMBz BSqBC7Lv+DiG+gDGKvPjsuYgeZCL5uYzDL7iNkmAXn32Q9GQm7dUzop466hd5Z+v8LEW 13wHkJPKCfAZOylV/tFagcJON6MbvsXv1Re6nVluogpvLj1P5htZxIDUnuLAd3vabOYB qtwWH+FWcYzNier4MEDcN3SW+PsRHHijg0eDdnclBYrxWXSMcMCyvEKM6hfqhKi6FfcD o5Jc9VvgOKjEOshETsNYj4WiLWTqCNoZVdkO5SDVfrinvPed+PLtQlw8A/xJP38m4rLV 9qAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-143185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p9-20020ad452c9000000b00696a2af2eafsi4078489qvs.610.2024.04.12.11.16.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:16:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143185-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; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-143185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com 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 5DDFB1C21ADA for ; Fri, 12 Apr 2024 18:16:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBE4914E2C5; Fri, 12 Apr 2024 18:16:19 +0000 (UTC) Received: from gentwo.org (gentwo.org [62.72.0.81]) (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 4B80014D70E for ; Fri, 12 Apr 2024 18:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.72.0.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712945779; cv=none; b=PrwObrjgjLH7DuR7VJyJbU/aR3tmHxckJDb4noUQ4ZrtZNF4JXkvEaTjbE0JnITNYQZo2MZctYcBSAEScnA4nD/vUoOmldoEqqzMBrsZFruu4480pxOfaYuBb/tk2QgBkOIWehKBZrFtOFyCtl3dwBdYpRzepC2Mu4uEMD3gFaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712945779; c=relaxed/simple; bh=WWXEsl0DDy0E7PW+5dOmtMA8fTtGxsREx4qh4SvPSKA=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=tx/VOGJurR10rLeGGKBltigwLC05UeolLWT/D6eIlotUc/hPNPBnnmyo9JYans1pbAa5m7sGe/eEgaxD9sZ3YOtDLe0V1PChvjpROROqZ/IdJxTk0hVzjJ7o/6bzTT+Q3LZV+fa2sukDpB7iHoNn1vpKPsCoZxkZXBi+hEGFXf8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com; spf=fail smtp.mailfrom=linux.com; arc=none smtp.client-ip=62.72.0.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=linux.com Received: by gentwo.org (Postfix, from userid 1003) id 7593640A96; Fri, 12 Apr 2024 11:16:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 72EDE40A8D; Fri, 12 Apr 2024 11:16:10 -0700 (PDT) Date: Fri, 12 Apr 2024 11:16:10 -0700 (PDT) From: "Christoph Lameter (Ampere)" To: Jianfeng Wang cc: Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, junxiao.bi@oracle.com Subject: Re: [PATCH] slub: limit number of slabs to scan in count_partial() In-Reply-To: Message-ID: References: <20240411164023.99368-1-jianfeng.w.wang@oracle.com> <38ef26aa-169b-48ad-81ad-8378e7a38f25@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed On Fri, 12 Apr 2024, Jianfeng Wang wrote: >>> Can you run some tests showing the difference between the estimation and >>> the real count? > > Yes. > On a server with one NUMA node, I create a case that uses many dentry objects. > For "dentry", the length of partial slabs is slightly above 250000. Then, I > compare my approach of scanning N slabs from the list's head v.s. the original > approach of scanning the full list. I do it by getting both results using > the new and the original count_partial() and printing them in /proc/slabinfo. > > N = 10000 > my_result = 4741651 > org_result = 4744966 > diff = (org_result - my_result) / org_result = 0.00069 = 0.069 % > > Increasing N further to 25000 will only slight improve the accuracy: > N = 15000 -> diff = 0.02 % > N = 20000 -> diff = 0.01 % > N = 25000 -> diff = -0.017 % > > Based on the measurement, I think the difference between the estimation and > the real count is very limited (i.e. less than 0.1% for N = 10000). The > benefit is significant: shorter execution time for get_slabinfo(); no more > soft lockups or crashes caused by count_partial(). Wow. That is good. Maybe decrease N to 1000 instead?