* [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details
@ 2026-06-20 12:27 Doehyun Baek
2026-06-22 14:59 ` Michal Koutný
2026-06-22 16:41 ` Nhat Pham
0 siblings, 2 replies; 5+ messages in thread
From: Doehyun Baek @ 2026-06-20 12:27 UTC (permalink / raw)
To: Tejun Heo, Jonathan Corbet
Cc: Johannes Weiner, Michal Koutný, Andrew Morton, Shakeel Butt,
Roman Gushchin, Yosry Ahmed, Nhat Pham, cgroups, linux-doc,
linux-kernel, Doehyun Baek
Fix minor cgroup v2 memory.stat documentation issues. Correct the
vmalloc per-node marker now that vmalloc uses the native NR_VMALLOC node
stat, and document zswap_incomp as a byte-valued memory amount instead
of as a page counter.
Fixes: c466412c73c3 ("mm: memcontrol: switch to native NR_VMALLOC vmstat counter")
Fixes: 5ad41a38c364 ("mm: zswap: add per-memcg stat for incompressible pages")
Signed-off-by: Doehyun Baek <doehyunbaek@gmail.com>
---
Documentation/admin-guide/cgroup-v2.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index 993446ab66d0..ce6741f78f4f 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -1570,7 +1570,7 @@ The following nested keys are defined.
sock (npn)
Amount of memory used in network transmission buffers
- vmalloc (npn)
+ vmalloc
Amount of memory used for vmap backed memory.
shmem
@@ -1735,7 +1735,7 @@ The following nested keys are defined.
Number of pages written from zswap to swap.
zswap_incomp
- Number of incompressible pages currently stored in zswap
+ Amount of memory used by incompressible pages currently stored in zswap
without compression. These pages could not be compressed to
a size smaller than PAGE_SIZE, so they are stored as-is.
base-commit: 1a3746ccbb0a97bed3c06ccde6b880013b1dddc1
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details
2026-06-20 12:27 [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details Doehyun Baek
@ 2026-06-22 14:59 ` Michal Koutný
2026-06-22 15:26 ` Doehyun Baek
2026-06-22 16:41 ` Nhat Pham
1 sibling, 1 reply; 5+ messages in thread
From: Michal Koutný @ 2026-06-22 14:59 UTC (permalink / raw)
To: Doehyun Baek
Cc: Tejun Heo, Jonathan Corbet, Johannes Weiner, Andrew Morton,
Shakeel Butt, Roman Gushchin, Yosry Ahmed, Nhat Pham, cgroups,
linux-doc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]
On Sat, Jun 20, 2026 at 12:27:51PM +0000, Doehyun Baek <doehyunbaek@gmail.com> wrote:
> Fix minor cgroup v2 memory.stat documentation issues. Correct the
> vmalloc per-node marker now that vmalloc uses the native NR_VMALLOC node
> stat, and document zswap_incomp as a byte-valued memory amount instead
> of as a page counter.
>
> Fixes: c466412c73c3 ("mm: memcontrol: switch to native NR_VMALLOC vmstat counter")
> Fixes: 5ad41a38c364 ("mm: zswap: add per-memcg stat for incompressible pages")
> Signed-off-by: Doehyun Baek <doehyunbaek@gmail.com>
> ---
> Documentation/admin-guide/cgroup-v2.rst | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
> index 993446ab66d0..ce6741f78f4f 100644
> --- a/Documentation/admin-guide/cgroup-v2.rst
> +++ b/Documentation/admin-guide/cgroup-v2.rst
> @@ -1570,7 +1570,7 @@ The following nested keys are defined.
> sock (npn)
> Amount of memory used in network transmission buffers
>
> - vmalloc (npn)
> + vmalloc
> Amount of memory used for vmap backed memory.
The vmalloc change looks OK...
>
> shmem
> @@ -1735,7 +1735,7 @@ The following nested keys are defined.
> Number of pages written from zswap to swap.
>
> zswap_incomp
> - Number of incompressible pages currently stored in zswap
> + Amount of memory used by incompressible pages currently stored in zswap
> without compression. These pages could not be compressed to
> a size smaller than PAGE_SIZE, so they are stored as-is.
...but what do you mean by this?
As I'm looking at the code in obj_cgroup_charge_zswap() and
memcg_page_state_output_unit(), I'd say those are pages and the docs is
thus alright.
Thanks,
Michal
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details
2026-06-22 14:59 ` Michal Koutný
@ 2026-06-22 15:26 ` Doehyun Baek
2026-06-22 16:25 ` Michal Koutný
0 siblings, 1 reply; 5+ messages in thread
From: Doehyun Baek @ 2026-06-22 15:26 UTC (permalink / raw)
To: Michal Koutný
Cc: Tejun Heo, Jonathan Corbet, Johannes Weiner, Andrew Morton,
Shakeel Butt, Roman Gushchin, Yosry Ahmed, Nhat Pham, cgroups,
linux-doc, linux-kernel
> ...but what do you mean by this?
> As I'm looking at the code in obj_cgroup_charge_zswap() and
> memcg_page_state_output_unit(), I'd say those are pages and the docs is
> thus alright.
>
> Thanks,
> Michal
Thanks for taking a look.
I agree that the counters are pages internally. I was talking about what
gets printed in memory.stat.
The internal updates are page-count based:
mod_memcg_state(memcg, MEMCG_ZSWAPPED, 1);
if (size == PAGE_SIZE)
mod_memcg_state(memcg, MEMCG_ZSWAP_INCOMP, 1);
However, both zswapped and zswap_incomp are memory_stats[] entries, so
memory.stat prints them through memcg_page_state_output(). Since
MEMCG_ZSWAP_INCOMP is not special-cased as a raw count, the stored page
count is multiplied by the default PAGE_SIZE unit and exported as bytes.
unsigned long memcg_page_state_output(struct mem_cgroup *memcg, int item)
{
return memcg_page_state(memcg, item) *
memcg_page_state_output_unit(item);
}
Separately, this matches the existing documentation style for zswapped,
whose exported value is described as a memory amount:
zswapped
Amount of application memory swapped out to zswap.
Since zswap_incomp follows the same memory.stat output path, I think its
documentation should describe the exported value as a memory amount too.
I also boot-tested this in QEMU with the current tree and zswap enabled.
With incompressible pages pushed into zswap, memory.stat showed:
zswap 87822336
zswapped 87822336
zswap_incomp 87822336
The zswap_incomp value there is byte-valued; it is not a plain page
count. It also matches zswapped in this all-incompressible case, which
is consistent with both being exported as memory amounts.
Best,
Doehyun Baek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details
2026-06-22 15:26 ` Doehyun Baek
@ 2026-06-22 16:25 ` Michal Koutný
0 siblings, 0 replies; 5+ messages in thread
From: Michal Koutný @ 2026-06-22 16:25 UTC (permalink / raw)
To: Doehyun Baek
Cc: Tejun Heo, Jonathan Corbet, Johannes Weiner, Andrew Morton,
Shakeel Butt, Roman Gushchin, Yosry Ahmed, Nhat Pham, cgroups,
linux-doc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1585 bytes --]
On Mon, Jun 22, 2026 at 05:26:53PM +0200, Doehyun Baek <doehyunbaek@gmail.com> wrote:
> However, both zswapped and zswap_incomp are memory_stats[] entries, so
> memory.stat prints them through memcg_page_state_output(). Since
> MEMCG_ZSWAP_INCOMP is not special-cased as a raw count, the stored page
> count is multiplied by the default PAGE_SIZE unit and exported as bytes.
>
> unsigned long memcg_page_state_output(struct mem_cgroup *memcg, int item)
> {
> return memcg_page_state(memcg, item) *
> memcg_page_state_output_unit(item);
> }
Ah, I messed up how memcg_page_state_output_unit() is used. The printed
values are amounts (in bytes).
> Separately, this matches the existing documentation style for zswapped,
> whose exported value is described as a memory amount:
>
> zswapped
> Amount of application memory swapped out to zswap.
>
> Since zswap_incomp follows the same memory.stat output path, I think its
> documentation should describe the exported value as a memory amount too.
>
> I also boot-tested this in QEMU with the current tree and zswap enabled.
> With incompressible pages pushed into zswap, memory.stat showed:
>
> zswap 87822336
> zswapped 87822336
> zswap_incomp 87822336
Thanks for the test and for the fix!
>
> The zswap_incomp value there is byte-valued; it is not a plain page
> count. It also matches zswapped in this all-incompressible case, which
> is consistent with both being exported as memory amounts.
Acked-by: Michal Koutný <mkoutny@suse.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details
2026-06-20 12:27 [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details Doehyun Baek
2026-06-22 14:59 ` Michal Koutný
@ 2026-06-22 16:41 ` Nhat Pham
1 sibling, 0 replies; 5+ messages in thread
From: Nhat Pham @ 2026-06-22 16:41 UTC (permalink / raw)
To: Doehyun Baek
Cc: Tejun Heo, Jonathan Corbet, Johannes Weiner, Michal Koutný,
Andrew Morton, Shakeel Butt, Roman Gushchin, Yosry Ahmed, cgroups,
linux-doc, linux-kernel
On Sat, Jun 20, 2026 at 5:28 AM Doehyun Baek <doehyunbaek@gmail.com> wrote:
>
> Fix minor cgroup v2 memory.stat documentation issues. Correct the
> vmalloc per-node marker now that vmalloc uses the native NR_VMALLOC node
> stat, and document zswap_incomp as a byte-valued memory amount instead
> of as a page counter.
>
> Fixes: c466412c73c3 ("mm: memcontrol: switch to native NR_VMALLOC vmstat counter")
> Fixes: 5ad41a38c364 ("mm: zswap: add per-memcg stat for incompressible pages")
> Signed-off-by: Doehyun Baek <doehyunbaek@gmail.com>
> - Number of incompressible pages currently stored in zswap
> + Amount of memory used by incompressible pages currently stored in zswap
> without compression. These pages could not be compressed to
> a size smaller than PAGE_SIZE, so they are stored as-is.
>
Good catch :)
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-22 16:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-20 12:27 [PATCH] Docs/admin-guide/cgroup-v2: fix memory.stat doc details Doehyun Baek
2026-06-22 14:59 ` Michal Koutný
2026-06-22 15:26 ` Doehyun Baek
2026-06-22 16:25 ` Michal Koutný
2026-06-22 16:41 ` Nhat Pham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox