Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2439960ioo; Sat, 28 May 2022 13:46:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0+/G/49V6CeY8DRztW9/Il0p+vOffyu4VMB0o8M9QLK9r8HEAz7G47yRndtey2MB3VI2W X-Received: by 2002:a17:903:2445:b0:161:d47e:88cf with SMTP id l5-20020a170903244500b00161d47e88cfmr48114995pls.67.1653770771871; Sat, 28 May 2022 13:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770771; cv=none; d=google.com; s=arc-20160816; b=AUq59dvBtH3w7n2UV1866/3JIVYQeyRc9avpwt/PgDNJUI8fhjVJPzkV/N7Pz+9NsD RPYJKvu81kDV/oaZp7K6qlvthtjJMoprcrfdGwxb6xx53tkGt35yX961Sgmv6CpuaJZd 9EAXMN353VVxJ3NE7GCJbW51WTyfN1NvvG8PADkyz1FzQ7eHGsW5sd/Tg+YoFnRFokn0 YqDUhPoOCbuCOvjOevZw5gY1WpOzsfcGsq9/F6gaBr8pikBpFX6LfzxTpszM1FUWD7d5 Csc1OSfscsVbkSs+6o9PUTBUoMWPc1w8rl0T0hjCvKWOmP5SU2qHaNKlKibIkoE0klR1 /AYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=qtEaIxsw5G8XbzZIdfhwIUxQJQ2YrDlSK/U8opLS5VE=; b=CTm6AAJOj5qidCD+fGJ6ViE5VruLFvsFKx9FSgaTUOp1ZLnJPKJsnpDF0qeNiFaiqc 9uMTotO+wMCAOiFMIRj5B5dKMohP9/p5mXk8k+6eUhK64zN+xSWCceuMgP+QBvxoXk6h 50Wvd5Dt15kJT02978kWOE/Qlfx8aC5YMzPc0e6kGdMEQCNN9cm47CzkhU0u3Svnf6rG JtDqmJuJjH+igH+R8aKqO/2AJdrTaSVdR+j1bAmj48yzfFQE96PaU9UFYaFJjFs6OhaW +md2NSabv/VjdXfk76vDlvWe14gS+YTSUUQwkr36wlolGJ3QS57zUs+oCBdrMkWjjlLx RG5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uJmYv7HW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m18-20020a17090ab79200b001e285f0889esi4785295pjr.35.2022.05.28.13.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:46:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uJmYv7HW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B609674C2; Sat, 28 May 2022 12:45:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231428AbiEZUfj (ORCPT + 99 others); Thu, 26 May 2022 16:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243614AbiEZUfb (ORCPT ); Thu, 26 May 2022 16:35:31 -0400 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DDC3DFF5B for ; Thu, 26 May 2022 13:35:28 -0700 (PDT) Date: Thu, 26 May 2022 13:35:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1653597326; 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: in-reply-to:in-reply-to:references:references; bh=qtEaIxsw5G8XbzZIdfhwIUxQJQ2YrDlSK/U8opLS5VE=; b=uJmYv7HWNHzyySdL3Ivc7VcwtzGR77/g/JslvuNg6Kjyo8jmBw/xmbL/rilyPqWHd7qihF u31SUyLUZ67z01O6iul5OQokizMSNpy7CjROd5lMbm+Xd5EypugvQAxfvaD8pg7eKQiWgY KTIv1nPHYAM9BE8qCSThUxGyYqN9C24= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Muchun Song Cc: Andrew Morton , linux-mm@kvack.org, Dave Chinner , linux-kernel@vger.kernel.org, Kent Overstreet , Hillf Danton , Christophe JAILLET Subject: Re: [PATCH v4 4/6] mm: docs: document shrinker debugfs Message-ID: References: <20220525202600.2910982-1-roman.gushchin@linux.dev> <20220525202600.2910982-5-roman.gushchin@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 26, 2022 at 10:25:47AM +0800, Muchun Song wrote: > On Wed, May 25, 2022 at 01:25:58PM -0700, Roman Gushchin wrote: > > Add a document describing the shrinker debugfs interface. > > > > Signed-off-by: Roman Gushchin > > --- > > Documentation/admin-guide/mm/index.rst | 1 + > > .../admin-guide/mm/shrinker_debugfs.rst | 100 ++++++++++++++++++ > > 2 files changed, 101 insertions(+) > > create mode 100644 Documentation/admin-guide/mm/shrinker_debugfs.rst > > > > diff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst > > index c21b5823f126..1bd11118dfb1 100644 > > --- a/Documentation/admin-guide/mm/index.rst > > +++ b/Documentation/admin-guide/mm/index.rst > > @@ -36,6 +36,7 @@ the Linux memory management. > > numa_memory_policy > > numaperf > > pagemap > > + shrinker_debugfs > > soft-dirty > > swap_numa > > transhuge > > diff --git a/Documentation/admin-guide/mm/shrinker_debugfs.rst b/Documentation/admin-guide/mm/shrinker_debugfs.rst > > new file mode 100644 > > index 000000000000..2033d696aa59 > > --- /dev/null > > +++ b/Documentation/admin-guide/mm/shrinker_debugfs.rst > > @@ -0,0 +1,100 @@ > > +.. _shrinker_debugfs: > > + > > +========================== > > +Shrinker Debugfs Interface > > +========================== > > + > > +Shrinker debugfs interface provides a visibility into the kernel memory > > +shrinkers subsystem and allows to get information about individual shrinkers. > > + > > +For each shrinker registered in the system a directory in **/shrinker/** > > +is created. The directory's name is composed from the shrinker's name and an > > +unique id: e.g. *kfree_rcu-0* or *sb-xfs:vda1-36*. > > + > > +Each shrinker directory contains the **count** file, which allows to trigger > > +the *count_objects()* callback for each memcg and numa node (if applicable). > > + > > +Usage: > > +------ > > + > > +1. *List registered shrinkers* > > + > > + :: > > + > > + $ cd /sys/kernel/debug/shrinker/ > > + $ ls > > + dqcache-16 sb-hugetlbfs-17 sb-rootfs-2 sb-tmpfs-49 > > + kfree_rcu-0 sb-hugetlbfs-33 sb-securityfs-6 sb-tracefs-13 > > + sb-aio-20 sb-iomem-12 sb-selinuxfs-22 sb-xfs:vda1-36 > > + sb-anon_inodefs-15 sb-mqueue-21 sb-sockfs-8 sb-zsmalloc-19 > > + sb-bdev-3 sb-nsfs-4 sb-sysfs-26 shadow-18 > > + sb-bpf-32 sb-pipefs-14 sb-tmpfs-1 thp_deferred_split-10 > > + sb-btrfs:vda2-24 sb-proc-25 sb-tmpfs-27 thp_zero-9 > > + sb-cgroup2-30 sb-proc-39 sb-tmpfs-29 xfs_buf-vda1-37 > > + sb-configfs-23 sb-proc-41 sb-tmpfs-35 xfs_inodegc-vda1-38 > > + sb-dax-11 sb-proc-45 sb-tmpfs-40 zspool-zram0-34 > > + sb-debugfs-7 sb-proc-46 sb-tmpfs-42 > > + sb-devpts-28 sb-proc-47 sb-tmpfs-43 > > + sb-devtmpfs-5 sb-pstore-31 sb-tmpfs-44 > > + > > +2. *Get information about a specific shrinker* > > + > > + :: > > + > > + $ cd sb-btrfs\:vda2-24/ > > + $ ls > > + count > > + > > +3. *Count objects* > > + > > + Each line in the output has the following format:: > > + > > + ... > > + ... > > + ... > > + > > + If there are no objects on all numa nodes, a line is omitted. If there > > + are no objects at all, the output might be empty. > > Should we add the following lines into here? > > " > If the shrinker is not memcg-aware or CONFIG_MEMCG is off, 0 is > printed as cgroup inode id. If the shrinker is not numa-aware, 0's are > printed for all nodes except the first one. > " Yes, it sounds like a great addition. I hope Andrew can merge this in if there will be no v5. Or I'll add it by myself otherwise. Thanks! And thank you for reviewing the patches!