Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1259176lfc; Wed, 1 Jun 2022 13:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjA+obyIa7RRNf2EPmCodLVDU5GJNQO8coy/xdZ00AN0BLEIjSLkJ+SgrK2mW5i+PJjwYK X-Received: by 2002:a63:d94b:0:b0:3fc:8486:2a6 with SMTP id e11-20020a63d94b000000b003fc848602a6mr941136pgj.23.1654114870579; Wed, 01 Jun 2022 13:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654114870; cv=none; d=google.com; s=arc-20160816; b=oz1+ghKF0GoowsZYdahvei9eSj0k+HhfK4BPEqM9Ii+/JDPmoKlXvCxsCCU8J4kH0L VbrJ5RY14+XFfzEkQhoNT9wrdLH7k5sqAhHxPepkX5DRRzLraeyuRgS2qObWWqCOXpoW BASEpmZ7cWRDNUnqtcsWwpJQkduZFizHR1y/frYP+iKETE0mFZTuTSDTsKWFsx9F+ghz QWk5x7JZ0evn+VVYIn1n9L5Is1O3FcLdWiEE7rjuwnQTYH/2GuK4YjpR9TnZTPgXeq9T zUhsiTDIT+pvMSI8boN+PQBFLY0X9Ix7X2lA9oEd6NkrqRZI13i0F5AjC0PcitiKPsYD GkFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S+h+HgblHAq+7ubsVLHYGIYwmou2leQ/VFhf0O5cRXI=; b=LbUCQNttVW+dMVm9ssZcqeWDNxP9Y7ykivJvJGA67RShByqT4bjr4p3KoxxcIXrODr 5sdr4VKFaoboGEWWhfBvJlib8wsb4vBOaJJa0PYUtIAuDwY6YFcbXLLm9+3XzZeCsBfa MExm07i/Q+KETmgpQdO1KVU4/hwMliKnKNtAlZ7BaHegvJEyfAxYt1F4JmlA4osInlIR Ptbd6drlMaHZYHW0l3XP6lDTd8mLbikV7452NlXiOIJ8C6XGMC/GK6/1hbIsrTBZ6YIh zilwasfXBlu1tgu735spximjfBntgOtmVTWmzuL9+NT7RoGtjaanYIYjZJGrbBBgvY33 lJOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=HJ2xUc7Z; 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 74-20020a63024d000000b003fcc510ca4dsi1289670pgc.715.2022.06.01.13.21.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:21:10 -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=HJ2xUc7Z; 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 1D9BA1BF81A; Wed, 1 Jun 2022 12:33:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349369AbiFADXH (ORCPT + 99 others); Tue, 31 May 2022 23:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349347AbiFADWu (ORCPT ); Tue, 31 May 2022 23:22:50 -0400 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6BC425EB0 for ; Tue, 31 May 2022 20:22:48 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1654053767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S+h+HgblHAq+7ubsVLHYGIYwmou2leQ/VFhf0O5cRXI=; b=HJ2xUc7ZFtmBpk+LeScpXf5vSy2rAZvWH/JAnDoZxqRBSEuuVcG8Tu2/ZaGVxs5FgqJYri /haJfEXRKgaMwlRHgl85nJ43lxIUt67LyFIQfnEs0Wvq5q7WZrT7A+mr2ZMAIgQb2etgPW vSZAqku2wsahYxR56atC6SCf/XPyAC0= From: Roman Gushchin To: Andrew Morton , linux-mm@kvack.org Cc: Dave Chinner , linux-kernel@vger.kernel.org, Kent Overstreet , Hillf Danton , Christophe JAILLET , Muchun Song , Roman Gushchin Subject: [PATCH v5 4/6] mm: docs: document shrinker debugfs Date: Tue, 31 May 2022 20:22:25 -0700 Message-Id: <20220601032227.4076670-5-roman.gushchin@linux.dev> In-Reply-To: <20220601032227.4076670-1-roman.gushchin@linux.dev> References: <20220601032227.4076670-1-roman.gushchin@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Add a document describing the shrinker debugfs interface. Signed-off-by: Roman Gushchin Reviewed-by: Muchun Song --- Documentation/admin-guide/mm/index.rst | 1 + .../admin-guide/mm/shrinker_debugfs.rst | 104 ++++++++++++++++++ 2 files changed, 105 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..1e0e5bdb8179 --- /dev/null +++ b/Documentation/admin-guide/mm/shrinker_debugfs.rst @@ -0,0 +1,104 @@ +.. _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 + dquota-cache-16 sb-devpts-28 sb-proc-47 sb-tmpfs-42 + mm-shadow-18 sb-devtmpfs-5 sb-proc-48 sb-tmpfs-43 + mm-zspool:zram0-34 sb-hugetlbfs-17 sb-pstore-31 sb-tmpfs-44 + rcu-kfree-0 sb-hugetlbfs-33 sb-rootfs-2 sb-tmpfs-49 + sb-aio-20 sb-iomem-12 sb-securityfs-6 sb-tracefs-13 + sb-anon_inodefs-15 sb-mqueue-21 sb-selinuxfs-22 sb-xfs:vda1-36 + sb-bdev-3 sb-nsfs-4 sb-sockfs-8 sb-zsmalloc-19 + sb-bpf-32 sb-pipefs-14 sb-sysfs-26 thp-deferred_split-10 + sb-btrfs:vda2-24 sb-proc-25 sb-tmpfs-1 thp-zero-9 + sb-cgroup2-30 sb-proc-39 sb-tmpfs-27 xfs-buf:vda1-37 + sb-configfs-23 sb-proc-41 sb-tmpfs-29 xfs-inodegc:vda1-38 + sb-dax-11 sb-proc-45 sb-tmpfs-35 + sb-debugfs-7 sb-proc-46 sb-tmpfs-40 + +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. + + 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. + :: + + $ cat count + 1 224 2 + 21 98 0 + 55 818 10 + 2367 2 0 + 2401 30 0 + 225 13 0 + 599 35 0 + 939 124 0 + 1041 3 0 + 1075 1 0 + 1109 1 0 + 1279 60 0 + 1313 7 0 + 1347 39 0 + 1381 3 0 + 1449 14 0 + 1483 63 0 + 1517 53 0 + 1551 6 0 + 1585 1 0 + 1619 6 0 + 1653 40 0 + 1687 11 0 + 1721 8 0 + 1755 4 0 + 1789 52 0 + 1823 888 0 + 1857 1 0 + 1925 2 0 + 1959 32 0 + 2027 22 0 + 2061 9 0 + 2469 799 0 + 2537 861 0 + 2639 1 0 + 2707 70 0 + 2775 4 0 + 2877 84 0 + 293 1 0 + 735 8 0 -- 2.35.3