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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD8BAC35670 for ; Mon, 24 Feb 2020 01:29:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 883D72071C for ; Mon, 24 Feb 2020 01:29:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 883D72071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1C1E66B0005; Sun, 23 Feb 2020 20:29:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 172686B0006; Sun, 23 Feb 2020 20:29:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0881D6B0007; Sun, 23 Feb 2020 20:29:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id E79A26B0005 for ; Sun, 23 Feb 2020 20:29:10 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B938B381E for ; Mon, 24 Feb 2020 01:29:10 +0000 (UTC) X-FDA: 76523287260.05.lace66_6d341e828df5a X-HE-Tag: lace66_6d341e828df5a X-Filterd-Recvd-Size: 2156 Received: from gentwo.org (gentwo.org [3.19.106.255]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Feb 2020 01:29:10 +0000 (UTC) Received: by gentwo.org (Postfix, from userid 1002) id D49103F070; Mon, 24 Feb 2020 01:29:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id D3A8B3E951; Mon, 24 Feb 2020 01:29:09 +0000 (UTC) Date: Mon, 24 Feb 2020 01:29:09 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Wen Yang cc: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Xunlei Pang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/slub: improve count_partial() for CONFIG_SLUB_CPU_PARTIAL In-Reply-To: <20200222092428.99488-1-wenyang@linux.alibaba.com> Message-ID: References: <20200222092428.99488-1-wenyang@linux.alibaba.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Bogosity: Ham, tests=bogofilter, spamicity=0.000188, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, 22 Feb 2020, Wen Yang wrote: > We also observed that in this scenario, CONFIG_SLUB_CPU_PARTIAL is turned > on by default, and count_partial() is useless because the returned number > is far from the reality. Well its not useless. Its just not counting the partial objects in per cpu partial slabs. Those are counted by a different counter it. > Therefore, we can simply return 0, then nr_free is also 0, and eventually > active_objects == total_objects. We do not introduce any regression, and > it's preferable to show the unrealistic uniform 100% slab utilization > rather than some very high but incorrect value. I suggest that you simply use the number of partial slabs and multiply them by the number of objects in a slab and use that as a value. Both values are readily available via /sys/kernel/slab/<...>/ You dont need a patch to do that.