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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 090E7C433F5 for ; Thu, 17 Feb 2022 00:14:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57A596B0078; Wed, 16 Feb 2022 19:14:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 501D36B007B; Wed, 16 Feb 2022 19:14:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37C306B007D; Wed, 16 Feb 2022 19:14:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 230336B0078 for ; Wed, 16 Feb 2022 19:14:04 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CA82995C83 for ; Thu, 17 Feb 2022 00:14:03 +0000 (UTC) X-FDA: 79150349166.12.9D823E6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id B9B7F20007 for ; Thu, 17 Feb 2022 00:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0taShrUPih+3p4BSy4RGDjvNxfWW0lmnA8lYBimTFpE=; b=wZB/kao/5BsVz6BMP4Y1m51xIH X3g5PXCZy8lgbGuMLL2Et44AMmjy51aUiM+PaASDH0y1wkiSfg08v2SoF+RJ0YzvbqgUhBaY2Eu1f AYsdfV/IsIeeDZncehrTSpzJwf7mN1msubknZCb9aGcTWbFL4/ipzPzULQZpazUS7pianfj41OwxS j3PtvmQAkHcXt8JHMob59xkATYL9GwKQLSWHw6trkoY/BfsMH5RV2BcXKJGiVzuLiI/66C581wdfN 4EvyAo9d+GUyZoo5rGTkSNo2hVcqCD3jjSk8Hzirlm6H/SQCkAddyfsQ0J3nE2HsHuItk/Y+24GBL WF0YDAmA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKUQj-00F91t-SG; Thu, 17 Feb 2022 00:13:53 +0000 Date: Thu, 17 Feb 2022 00:13:53 +0000 From: Matthew Wilcox To: Shakeel Butt Cc: Roman Gushchin , Vasily Averin , Andrew Morton , Linux MM , Vlastimil Babka Subject: Re: tools/cgroup/memcg_slabinfo.py is broken Message-ID: References: <327b9e92-88bb-d66f-e07c-526161db539b@virtuozzo.com> <35486a00-791c-3b1b-14e0-476e6242709b@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: 6feqbkx6amh67i1oyburqaygs9g5o16f X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B9B7F20007 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="wZB/kao/"; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: X-HE-Tag: 1645056842-288239 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Feb 16, 2022 at 03:57:39PM -0800, Shakeel Butt wrote: > On Wed, Feb 16, 2022 at 3:12 PM Matthew Wilcox wrote: > > > [...] > > > Here I'd keep _page (or _folio, if you want), because > > > it makes it clear that the function goes over all pages > > > (and is expensive therefore). > > > > But there's no intrinsic reason that it should. If that's a > > performance problem, you could keep slabs on a separate list > > from, eg, file or anon memory. > > > > Is there enough space in the struct slab for that list or do you mean > something different? Well, I don't know what data structure your for_each_page() uses, so I don't know what to suggest exactly. If it's an iteration over the entirety of memmap, then maybe you'd rather iterate over each kmem_cache like /proc/slabinfo does?