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 A9736C433EF for ; Thu, 26 May 2022 02:25:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E39A78D0003; Wed, 25 May 2022 22:25:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE5248D0001; Wed, 25 May 2022 22:25:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CADF98D0003; Wed, 25 May 2022 22:25:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BB4968D0001 for ; Wed, 25 May 2022 22:25:55 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 87177292 for ; Thu, 26 May 2022 02:25:55 +0000 (UTC) X-FDA: 79506303870.18.029C75D Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf31.hostedemail.com (Postfix) with ESMTP id 0299820013 for ; Thu, 26 May 2022 02:25:18 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id n8so329539plh.1 for ; Wed, 25 May 2022 19:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EEnCAXzIKzBX8a+ZY+aJ2FVWSHOtVfgunLZbATQpn20=; b=W10EKExlpftJBTnBqjNUAtnsiAUfHnABsGE5AlTLAqMh7GqgMpzzub0qFeCKCVsYBI KeJESH3gU6ZRM3zCCloADhZvmBC34vbmJ1A0ux21YgEfEkXyTPMQiAj1FRTZH0dQdDs1 Ekim+iwvxZin/MBLGykjoLbPHkGMRd+BmiMjRBL1XO9K9+EB0QkJGrGDG0O4InCtmhGP QtBOPPy1De6lyX/UaZGqAJMFyrpJCiwVTX5Dc+V8HtvDLPtGlskIVhgqJ70ddvHTgkSa zPy1N0vo40lEGaTADUjAp14MDRtNNTIx0XqsyM0IFtrQDE3o5cVsJMRTNTRLKtcEkA/F ox6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EEnCAXzIKzBX8a+ZY+aJ2FVWSHOtVfgunLZbATQpn20=; b=cV6Wl8qissOKJHSVRJqZzVKrEOQ8JZpvpJDm95XqBbZ9qAcnL7IAVRtDQ0crNQnG1W 0mJFJycPXtmNQ3ToXjcM5Qbq5ZB3ptQC9lAEpkvdrd0F4SvKpB2txD9KR/SylRwwVrto ESeqWjtrfpoqb+5egxE8iZloQPRW6mULIYIUqDeuI5YFkpHhzZQ2yobQQttx5y4whgng 68f8vcIOjL6SADw2CNaiNDvAl6t9YsKxDP7+oaqSlUm43/RYGey1dtHyF5s3y8uAL/TF I7Hc+jouoY8+S5EuIDPGQpn5IzBbN09DO+X9vLtyLEbnqlaojmqrw9aWaJ0+AeVVXJ83 MkNQ== X-Gm-Message-State: AOAM532jAl+xdDKs3Y9B1tDsCU+cgLHQFrpmkmAtB/Ukz9nBKN5duKbX BSOFCqjxkrbsGyNEaBdhE4wOEA== X-Google-Smtp-Source: ABdhPJwt2BGjxkJfOxtlg5m/+6B4LdTBLKQa+0e8AbzcbMWNE7G8FrsvHIdGFRHX3S0IoeNB39MgNg== X-Received: by 2002:a17:902:c7cd:b0:161:8b6f:73c3 with SMTP id r13-20020a170902c7cd00b001618b6f73c3mr35562226pla.156.1653531953263; Wed, 25 May 2022 19:25:53 -0700 (PDT) Received: from localhost ([2408:8207:18da:2310:c40c:3e14:bb57:48be]) by smtp.gmail.com with ESMTPSA id j18-20020a170903025200b001624f2b71b4sm101208plh.152.2022.05.25.19.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 19:25:52 -0700 (PDT) Date: Thu, 26 May 2022 10:25:47 +0800 From: Muchun Song To: Roman Gushchin 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: <20220525202600.2910982-5-roman.gushchin@linux.dev> Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=W10EKExl; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf31.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 0299820013 X-Stat-Signature: nftrubppr1dakid8gpwj7fqcfpzec65h X-HE-Tag: 1653531918-645653 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, 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. " Thanks.