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 878CAC433EF for ; Tue, 19 Apr 2022 04:27:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E6116B00CD; Tue, 19 Apr 2022 00:27:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06F236B00CF; Tue, 19 Apr 2022 00:27:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E51576B00D1; Tue, 19 Apr 2022 00:27:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id D4B096B00CD for ; Tue, 19 Apr 2022 00:27:12 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 9D14E6116A for ; Tue, 19 Apr 2022 04:27:12 +0000 (UTC) X-FDA: 79372343904.19.E7B2AE0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 93B6F40002 for ; Tue, 19 Apr 2022 04:27:10 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 36010611CA; Tue, 19 Apr 2022 04:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53E07C385A7; Tue, 19 Apr 2022 04:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1650342430; bh=U87XC1YEsD2BTQUvV8SJzW0Xi6JkPFRYfotP8FuYOXs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dQrCWZVZ3Vj91DG/8XP28ubGi1QZkqEtifxM67rP1rMkDDavcGrXSeD13dXoMjkCK 9LCptanc9Zpeo+Citnuucwe7rxFq133eT7rW/lrq3LfuIITwvVKLvtA9UaM1R/CLwR pWV7yBj+dkh+iKMYd7gAigkWbqNTd2z7bOqz3uB0= Date: Mon, 18 Apr 2022 21:27:09 -0700 From: Andrew Morton To: Roman Gushchin Cc: linux-mm@kvack.org, Dave Chinner , linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Yang Shi Subject: Re: [PATCH rfc 0/5] mm: introduce shrinker sysfs interface Message-Id: <20220418212709.42f2ba15e00999bb57086b27@linux-foundation.org> In-Reply-To: <20220416002756.4087977-1-roman.gushchin@linux.dev> References: <20220416002756.4087977-1-roman.gushchin@linux.dev> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 93B6F40002 X-Stat-Signature: 6uomn1q4reqfa4g3xrzn51qpe5ie9x5m Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=dQrCWZVZ; dmarc=none; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1650342430-138643 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 Fri, 15 Apr 2022 17:27:51 -0700 Roman Gushchin wrote: > There are 50+ different shrinkers in the kernel, many with their own bells and > whistles. Under the memory pressure the kernel applies some pressure on each of > them in the order of which they were created/registered in the system. Some > of them can contain only few objects, some can be quite large. Some can be > effective at reclaiming memory, some not. > > The only existing debugging mechanism is a couple of tracepoints in > do_shrink_slab(): mm_shrink_slab_start and mm_shrink_slab_end. They aren't > covering everything though: shrinkers which report 0 objects will never show up, > there is no support for memcg-aware shrinkers. Shrinkers are identified by their > scan function, which is not always enough (e.g. hard to guess which super > block's shrinker it is having only "super_cache_scan"). They are a passive > mechanism: there is no way to call into counting and scanning of an individual > shrinker and profile it. > > To provide a better visibility and debug options for memory shrinkers > this patchset introduces a /sys/kernel/shrinker interface, to some extent > similar to /sys/kernel/slab. > > For each shrinker registered in the system a folder is created. Please, "directory". > The folder > contains "count" and "scan" files, which allow to trigger count_objects() > and scan_objects() callbacks. For memcg-aware and numa-aware shrinkers > count_memcg, scan_memcg, count_node, scan_node, count_memcg_node > and scan_memcg_node are additionally provided. They allow to get per-memcg > and/or per-node object count and shrink only a specific memcg/node. > > To make debugging more pleasant, the patchset also names all shrinkers, > so that sysfs entries can have more meaningful names. I also was wondering "why not debugfs". > Usage examples: > > ... > > If the output doesn't fit into a single page, "...\n" is printed at the end of > output. Unclear. At the end of what output? > > Roman Gushchin (5): > mm: introduce sysfs interface for debugging kernel shrinker > mm: memcontrol: introduce mem_cgroup_ino() and > mem_cgroup_get_from_ino() > mm: introduce memcg interfaces for shrinker sysfs > mm: introduce numa interfaces for shrinker sysfs > mm: provide shrinkers with names > > arch/x86/kvm/mmu/mmu.c | 2 +- > ... > Nothing under Documentation/!