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.3 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 75DACC4BA20 for ; Wed, 26 Feb 2020 18:31:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2CF2520714 for ; Wed, 26 Feb 2020 18:31:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CF2520714 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 D0EC66B0070; Wed, 26 Feb 2020 13:31:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CBF276B0071; Wed, 26 Feb 2020 13:31:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD6206B0073; Wed, 26 Feb 2020 13:31:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id A2A6D6B0070 for ; Wed, 26 Feb 2020 13:31:29 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8BCDE2C93 for ; Wed, 26 Feb 2020 18:31:29 +0000 (UTC) X-FDA: 76533121098.12.mom54_816446a98771f X-HE-Tag: mom54_816446a98771f X-Filterd-Recvd-Size: 2179 Received: from gentwo.org (gentwo.org [3.19.106.255]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 26 Feb 2020 18:31:29 +0000 (UTC) Received: by gentwo.org (Postfix, from userid 1002) id 885B43EC05; Wed, 26 Feb 2020 18:31:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 875FF3EC04; Wed, 26 Feb 2020 18:31:28 +0000 (UTC) Date: Wed, 26 Feb 2020 18:31:28 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Roman Gushchin cc: Wen Yang , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , 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: <20200224165750.GA478187@carbon.dhcp.thefacebook.com> Message-ID: References: <20200222092428.99488-1-wenyang@linux.alibaba.com> <20200224165750.GA478187@carbon.dhcp.thefacebook.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.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 24 Feb 2020, Roman Gushchin wrote: > > 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/<...>/ > > So maybe something like this? > > @@ -5907,7 +5907,9 @@ void get_slabinfo(struct kmem_cache *s, struct slabinfo *sinfo) > for_each_kmem_cache_node(s, node, n) { > nr_slabs += node_nr_slabs(n); > nr_objs += node_nr_objs(n); > +#ifndef CONFIG_SLUB_CPU_PARTIAL > nr_free += count_partial(n, count_free); > +#endif > } Why would not having cpu partials screws up the counting of objects in partial slabs? You dont need kernel mods for this. The numbers are exposed already in /sys/kernel/slab/xxx.