Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp758108rdb; Thu, 22 Feb 2024 21:01:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUu1fgvupws1oh4kevB/esXGcpDFJoH8HKhFrtv7D0NNS3eEsMKk5rD24g4AusErwlXG42pdzkG6MSIFwh8BhKNXnWOb8ODkGkugCRq1A== X-Google-Smtp-Source: AGHT+IFhx/Omryeg9HAXkFYztq6Ied0e/RH/Vbc3lxL7frTgTXBZXpnczQ1iuMlnQp27APHM5iJR X-Received: by 2002:a05:6512:20c8:b0:512:da79:91a with SMTP id u8-20020a05651220c800b00512da79091amr576820lfr.46.1708664463907; Thu, 22 Feb 2024 21:01:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708664463; cv=pass; d=google.com; s=arc-20160816; b=Mk7b2GTm3VSnHfAfSoKoKxZ8VrH4xxr5NvFaoMNZv+JQAgXz0IrBmxvJyfvsRLI7NA EQsyN/SA5AUMl0fFtFmAkgwEzsFgpF4PcnBkcjeQdEe2T9DShfen4G/8BxS+LKPxDAxc 61thXVWInjnj4CRCGLiHMoMEE1Uwls2HvzTn6e7KqzIW1yfHfxnjsCAPo6ekqcyO5yKp 8xmkkIGkOiwTlMUQVacRLzkOAEe5ZP3I7gR5NJg863XhSX4FxMj8AU07mXj5neaSjKqO AeuhS0hvGLjKKeGfJ6VuGY/9xJ1Uz0GumRJus2h7EQkco/t33qDQL+4qTPyzeO7l4x1P 1QgQ== 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=44xWYjkvEitvr2LpqKYpVHLl/pWnfYZs1Xfy0OuFJbw=; fh=pMTjl89JUNsdj6JsChtd6gNMI7Wq7DO3BHiL2BED3FA=; b=TC4nBnkfr0jFA/+uV9ckRbazu51HedjADatjw3DoIQ3d/S+i9y0Gsl1aZBHodaomiO EEItSkdL+s8R0wRkn48NB6vhva5wqjPvZB1es5axZb5mLOwlY3B+5HbQlQLgnNXsD00P RVvjIDt+m754PV7jiZlMHYwdA2Me8kU3N5U30hog9+ElSHHjpsNhzUET4YfFHWf/4uin gxDpwLsj6jqH3Cbi51d+cnrEv6w8P1OqpdRoXykOxog6hYDks7U0ASkOFAjbt8lVDzum J3xa/HJ2JMSeyUlsrX76EiZjAvd2rOWk5hUmdPiC+rVhMDIlU0ehBEj9IDsE2RJIyz97 9XkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mHqP772C; 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-77777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77777-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h14-20020a1709063b4e00b00a3e3c7a4969si5550221ejf.881.2024.02.22.21.01.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 21:01:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mHqP772C; 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-77777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77777-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 75F341F23B79 for ; Fri, 23 Feb 2024 05:01:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5AE711739; Fri, 23 Feb 2024 05:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mHqP772C" 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 5C4BD11706 for ; Fri, 23 Feb 2024 05:00:48 +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=1708664451; cv=none; b=s2q3sQwDJqwvgLf6ESI74w4VzuCayhzr5c0kMW/ura/oRZZo6A/pFwdFyF4WDNmB6H9aksYalhQrg+aqUVOaMa8eehQ3kdki7fNPZzLd+7+NE1X3NAtaL1bN3KPkTehsLrKPWB27Dr870G2ItVkUl8uO83IT0H2ANPFmWSUSp0E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708664451; c=relaxed/simple; bh=Que1evLbnFfHRKzVpQkiqW6XLuqZSBE2U004J7wfB1g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WlIgm2VOqzD8OInluDdP0GraWbot6Mu8I82o8OHg4/QkkuvS2/EAIZ9ECFnY68JI7kNwhICbZYUXnBkRy7X+U874PNMq42Nm+Xbyw499sWXclmx3ryPKzBUx3Ekf66fWxZYDSQTw/BLu4e5Ac5h6Bpc3IdwhvDpdeWrUBmUX0n4= 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=mHqP772C; 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: <347b870e-a7d5-45df-84ba-4eee37b74ff6@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708664446; 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=44xWYjkvEitvr2LpqKYpVHLl/pWnfYZs1Xfy0OuFJbw=; b=mHqP772ChKDinSnQ925Tx/lQvvV6L4V4Qy8/FIogSIb1hkSpr01P6b5cfW5cz+tA26Hr/q sy5sDLAP7wNNgiZi/Fe386kHg36Tw22uAd006IjT6voIAtvlecUhl7xYLDtviEgqlJmA+7 QhEucaJDD+nkDy3EExHa4388hqCHfNs= Date: Fri, 23 Feb 2024 13:00:13 +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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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. > I think this is a better direction! We can use RCU list if slab can be freed by RCU.