From: Jonathan Corbet <corbet@lwn.net>
To: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>
Cc: Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>,
"mkoutny@suse.com" <mkoutny@suse.com>,
"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Waiman Long <llong@redhat.com>
Subject: Re: [PATCH v2] Documentation/cgroup-v2: Update memory.{stat,numa_stat} description to reflect possible units
Date: Thu, 16 Jan 2025 08:12:51 -0700 [thread overview]
Message-ID: <87frli3i8c.fsf@trenco.lwn.net> (raw)
In-Reply-To: <4e96a241-a996-4289-9ac5-dc1ff65cbff8@fujitsu.com>
"Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com> writes:
> Hi Jonathan,
>
>
> On 14/01/2025 01:49, Jonathan Corbet wrote:
>> Li Zhijian <lizhijian@fujitsu.com> writes:
>>
>>> The description of the memory.{stat,numa_stat} file has been updated to
>>> clarify that the output values can be in bytes or pages.
>>> This change ensures that users are aware that the unit of measurement for
>>> memory values can vary and should be verified by consulting the memory.stat
>>>
>>> It's known that
>>> workingset_*, pg* are counted in pages
>>>
>>> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>a
>>> ---
>>> V2: updated the document as suggestion from Michal
>>> updated subject and commit log
>>> ---
>>> Documentation/admin-guide/cgroup-v2.rst | 9 +++++----
>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
>>> index 315ede811c9d..0a43be0c32d1 100644
>>> --- a/Documentation/admin-guide/cgroup-v2.rst
>>> +++ b/Documentation/admin-guide/cgroup-v2.rst
>>> @@ -1427,7 +1427,7 @@ The following nested keys are defined.
>>> types of memory, type-specific details, and other information
>>> on the state and past events of the memory management system.
>>>
>>> - All memory amounts are in bytes.
>>> + All memory amounts are in bytes unless said otherwise.
>>>
>>> The entries are ordered to be human readable, and new entries
>>> can show up in the middle. Don't rely on items remaining in a
>>> @@ -1673,11 +1673,12 @@ The following nested keys are defined.
>>> application performance by combining this information with the
>>> application's CPU allocation.
>>>
>>> - All memory amounts are in bytes.
>>> -
>>> The output format of memory.numa_stat is::
>>>
>>> - type N0=<bytes in node 0> N1=<bytes in node 1> ...
>>> + type N0=<value for node 0> N1=<value for node 1> ...
>>> +
>>> + The 'value' can be in bytes or pages, depending on the specific
>>> + type of memory. To determine the unit, refer to the memory.stat.
>>
>> This seems like useful information - but can we really not give better
>> guidance to our readers on how to interpret this value? What in "the
>> memory.stat" will tell them which units are in use?
>
> Let me quote a piece of the numa.stat:
>
> In pages:
>> pgdemote_khugepaged
>> Number of pages demoted by khugepaged.
>
> In bytes:
>> file
>> Amount of memory used to cache filesystem data,
>> including tmpfs and shared memory.
>
> Prior to this reference to `memory.stat`, the previous `memory.numa_stat` also
> relied on `memory.stat` to determine which entries were present.
> Therefore, adding this current reference to `memory.stat` does not introduce
> additional complexity.
>
> 1680 The 'value' can be in bytes or pages, depending on the specific
> 1681 type of memory. To determine the unit, refer to the memory.stat.
> 1682
> 1683 The entries are ordered to be human readable, and new entries
> 1684 can show up in the middle. Don't rely on items remaining in a
> 1685 fixed position; use the keys to look up specific values!
> 1686
> 1687 The entries can refer to the memory.stat. <<< the original reference
...but neither does it help our reader. Can we at least point to
something that would help them to make sense of this value?
>> (Even better, could we fix the code to always return the same units
>> without breaking something somewhere?)
>
> Of course, I am not opposed to having all entries use the same unit.
> At a glance, there are quite a few entries within `memory.stat` that are
> actually measured in pages. Do we truly request to this significant modification?
No, I am not asking you to do that - I was just thinking that it could
be a good idea. But there may be reasons for why things are the way
they are, and I do not know if such a change would be accepted by the
relevant maintainers or not.
jon
next prev parent reply other threads:[~2025-01-16 15:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 12:30 [PATCH] Documentation/cgroup-v2: Update memory.numa_stat description to reflect possible units Li Zhijian
2025-01-10 15:26 ` Waiman Long
2025-01-10 15:35 ` Michal Koutný
2025-01-13 0:38 ` Zhijian Li (Fujitsu)
2025-01-13 1:05 ` [PATCH v2] Documentation/cgroup-v2: Update memory.{stat,numa_stat} " Li Zhijian
2025-01-13 8:58 ` Bagas Sanjaya
2025-01-13 17:49 ` Jonathan Corbet
2025-01-16 5:50 ` Zhijian Li (Fujitsu)
2025-01-16 15:12 ` Jonathan Corbet [this message]
2025-01-16 17:19 ` Tejun Heo
2025-01-17 3:09 ` Zhijian Li (Fujitsu)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frli3i8c.fsf@trenco.lwn.net \
--to=corbet@lwn.net \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhijian@fujitsu.com \
--cc=llong@redhat.com \
--cc=mkoutny@suse.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox