lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ca76824-331f-407f-afa6-bf75cdca6d96@redhat.com>
Date: Tue, 13 Aug 2024 14:23:57 -0400
From: Waiman Long <longman@...hat.com>
To: Yuanchu Xie <yuanchu@...gle.com>, David Hildenbrand <david@...hat.com>,
 "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
 Khalid Aziz <khalid.aziz@...cle.com>, Henry Huang <henry.hj@...group.com>,
 Yu Zhao <yuzhao@...gle.com>, Dan Williams <dan.j.williams@...el.com>,
 Gregory Price <gregory.price@...verge.com>, Huang Ying
 <ying.huang@...el.com>, Andrew Morton <akpm@...ux-foundation.org>,
 Lance Yang <ioworker0@...il.com>, Randy Dunlap <rdunlap@...radead.org>,
 Muhammad Usama Anjum <usama.anjum@...labora.com>
Cc: Kalesh Singh <kaleshsingh@...gle.com>, Wei Xu <weixugc@...gle.com>,
 David Rientjes <rientjes@...gle.com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>, Johannes Weiner
 <hannes@...xchg.org>, Michal Hocko <mhocko@...nel.org>,
 Roman Gushchin <roman.gushchin@...ux.dev>,
 Muchun Song <muchun.song@...ux.dev>, Shuah Khan <shuah@...nel.org>,
 Yosry Ahmed <yosryahmed@...gle.com>, Matthew Wilcox <willy@...radead.org>,
 Sudarshan Rajagopalan <quic_sudaraja@...cinc.com>,
 Kairui Song <kasong@...cent.com>, "Michael S. Tsirkin" <mst@...hat.com>,
 Vasily Averin <vasily.averin@...ux.dev>, Nhat Pham <nphamcs@...il.com>,
 Miaohe Lin <linmiaohe@...wei.com>, Qi Zheng <zhengqi.arch@...edance.com>,
 Abel Wu <wuyun.abel@...edance.com>,
 "Vishal Moola (Oracle)" <vishal.moola@...il.com>,
 Kefeng Wang <wangkefeng.wang@...wei.com>, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org, cgroups@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v3 7/7] Docs/admin-guide/mm/workingset_report: document
 sysfs and memcg interfaces


On 8/13/24 12:56, Yuanchu Xie wrote:
> Add workingset reporting documentation for better discoverability of
> its sysfs and memcg interfaces. Also document the required kernel
> config to enable workingset reporting.
>
> Change-Id: Ib9dfc9004473baa6ef26ca7277d220b6199517de
> Signed-off-by: Yuanchu Xie <yuanchu@...gle.com>
> ---
>   Documentation/admin-guide/mm/index.rst        |   1 +
>   .../admin-guide/mm/workingset_report.rst      | 105 ++++++++++++++++++

The new memory cgroup control files need to be documented in 
Documentation/admin-guide/cgroup-v2.rst as well.

Cheers,
Longman

>   2 files changed, 106 insertions(+)
>   create mode 100644 Documentation/admin-guide/mm/workingset_report.rst
>
> diff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst
> index 8b35795b664b..61a2a347fc91 100644
> --- a/Documentation/admin-guide/mm/index.rst
> +++ b/Documentation/admin-guide/mm/index.rst
> @@ -41,4 +41,5 @@ the Linux memory management.
>      swap_numa
>      transhuge
>      userfaultfd
> +   workingset_report
>      zswap
> diff --git a/Documentation/admin-guide/mm/workingset_report.rst b/Documentation/admin-guide/mm/workingset_report.rst
> new file mode 100644
> index 000000000000..ddcc0c33a8df
> --- /dev/null
> +++ b/Documentation/admin-guide/mm/workingset_report.rst
> @@ -0,0 +1,105 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +=================
> +Workingset Report
> +=================
> +Workingset report provides a view of memory coldness in user-defined
> +time intervals, i.e. X bytes are Y milliseconds cold. It breaks down
> +the user pages in the system per-NUMA node, per-memcg, for both
> +anonymous and file pages into histograms that look like:
> +::
> +
> +    1000 anon=137368 file=24530
> +    20000 anon=34342 file=0
> +    30000 anon=353232 file=333608
> +    40000 anon=407198 file=206052
> +    9223372036854775807 anon=4925624 file=892892
> +
> +The workingset reports can be used to drive proactive reclaim, by
> +identifying the number of cold bytes in a memcg, then writing to
> +``memory.reclaim``.
> +
> +Quick start
> +===========
> +Build the kernel with the following configurations. The report relies
> +on Multi-gen LRU for page coldness.
> +
> +* ``CONFIG_LRU_GEN=y``
> +* ``CONFIG_LRU_GEN_ENABLED=y``
> +* ``CONFIG_WORKINGSET_REPORT=y``
> +
> +Optionally, the aging kernel daemon can be enabled with the following
> +configuration.
> +* ``CONFIG_WORKINGSET_REPORT_AGING=y``
> +
> +Sysfs interfaces
> +================
> +``/sys/devices/system/node/nodeX/workingset_report/page_age`` provides
> +a per-node page age histogram, showing an aggregate of the node's lruvecs.
> +Reading this file causes a hierarchical aging of all lruvecs, scanning
> +pages and creates a new Multi-gen LRU generation in each lruvec.
> +For example:
> +::
> +
> +    1000 anon=0 file=0
> +    2000 anon=0 file=0
> +    100000 anon=5533696 file=5566464
> +    18446744073709551615 anon=0 file=0
> +
> +``/sys/devices/system/node/nodeX/workingset_report/page_age_intervals``
> +is a comma separated list of time in milliseconds that configures what
> +the page age histogram uses for aggregation. For the above histogram,
> +the intervals are:
> +::
> +    1000,2000,100000
> +
> +``/sys/devices/system/node/nodeX/workingset_report/refresh_interval``
> +defines the amount of time the report is valid for in milliseconds.
> +When a report is still valid, reading the ``page_age`` file shows
> +the existing valid report, instead of generating a new one.
> +
> +``/sys/devices/system/node/nodeX/workingset_report/report_threshold``
> +specifies how often the userspace agent can be notified for node
> +memory pressure, in milliseconds. When a node reaches its low
> +watermarks and wakes up kswapd, programs waiting on ``page_age`` are
> +woken up so they can read the histogram and make policy decisions.
> +
> +Memcg interface
> +===============
> +While ``page_age_interval`` is defined per-node in sysfs, ``page_age``,
> +``refresh_interval`` and ``report_threshold`` are available per-memcg.
> +
> +``/sys/fs/cgroup/.../memory.workingset.page_age``
> +The memcg equivalent of the sysfs workingset page age histogram
> +breaks down the workingset of this memcg and its children into
> +page age intervals. Each node is prefixed with a node header and
> +a newline. Non-proactive direct reclaim on this memcg can also
> +wake up userspace agents that are waiting on this file.
> +e.g.
> +::
> +
> +    N0
> +    1000 anon=0 file=0
> +    2000 anon=0 file=0
> +    3000 anon=0 file=0
> +    4000 anon=0 file=0
> +    5000 anon=0 file=0
> +    18446744073709551615 anon=0 file=0
> +
> +``/sys/fs/cgroup/.../memory.workingset.refresh_interval``
> +The memcg equivalent of the sysfs refresh interval. A per-node
> +number of how much time a page age histogram is valid for, in
> +milliseconds.
> +e.g.
> +::
> +
> +    echo N0=2000 > memory.workingset.refresh_interval
> +
> +``/sys/fs/cgroup/.../memory.workingset.report_threshold``
> +The memcg equivalent of the sysfs report threshold. A per-node
> +number of how often userspace agent waiting on the page age
> +histogram can be woken up, in milliseconds.
> +e.g.
> +::
> +
> +    echo N0=1000 > memory.workingset.report_threshold


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ