* [PATCH v2] mm/hugetlb: add htlb_dissolve vmstat event
@ 2026-11-05 19:15 Mark Bundschuh
2026-11-05 23:39 ` Andrew Morton
2026-11-06 3:50 ` Muchun Song
0 siblings, 2 replies; 3+ messages in thread
From: Mark Bundschuh @ 2026-11-05 19:15 UTC (permalink / raw)
To: akpm, muchun.song, osalvador
Cc: david, jiaqiyan, linux-mm, linux-kernel, Mark Bundschuh
Memory offline and memory failure handling dissolve free hugetlb folios
and lower nr_hugepages. Nothing records this, so when the pool shrinks
it is hard to tell whether that or a write to nr_hugepages caused it.
Add an htlb_dissolve event, counted for each free folio that
dissolve_free_hugetlb_folio() takes out of the pool.
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
---
v2: say "takes out of the pool" instead of "frees" (Jiaqi)
v1: https://lore.kernel.org/all/20261105020324.2011790-1-mkbund@amazon.com/
include/linux/vm_event_item.h | 1 +
mm/hugetlb.c | 1 +
mm/vmstat.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 2628ccda076a..822fe862e5b3 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -71,6 +71,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
#endif
#ifdef CONFIG_HUGETLB_PAGE
HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
+ HTLB_DISSOLVE,
#endif
#ifdef CONFIG_CMA
CMA_ALLOC_SUCCESS,
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index da5d04edf7c1..7c79523b2a3c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2047,6 +2047,7 @@ int dissolve_free_hugetlb_folio(struct folio *folio)
}
update_and_free_hugetlb_folio(h, folio, false);
+ count_vm_event(HTLB_DISSOLVE);
return rc;
}
out:
diff --git a/mm/vmstat.c b/mm/vmstat.c
index a3e809c57f29..6282eef7074a 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1397,6 +1397,7 @@ const char * const vmstat_text[] = {
#ifdef CONFIG_HUGETLB_PAGE
[I(HTLB_BUDDY_PGALLOC)] = "htlb_buddy_alloc_success",
[I(HTLB_BUDDY_PGALLOC_FAIL)] = "htlb_buddy_alloc_fail",
+ [I(HTLB_DISSOLVE)] = "htlb_dissolve",
#endif
#ifdef CONFIG_CMA
[I(CMA_ALLOC_SUCCESS)] = "cma_alloc_success",
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
--
2.50.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] mm/hugetlb: add htlb_dissolve vmstat event
2026-11-05 19:15 [PATCH v2] mm/hugetlb: add htlb_dissolve vmstat event Mark Bundschuh
@ 2026-11-05 23:39 ` Andrew Morton
2026-11-06 3:50 ` Muchun Song
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2026-11-05 23:39 UTC (permalink / raw)
To: Mark Bundschuh
Cc: muchun.song, osalvador, david, jiaqiyan, linux-mm, linux-kernel
On Thu, 5 Nov 2026 19:15:08 +0000 Mark Bundschuh <mkbund@amazon.com> wrote:
> Memory offline and memory failure handling dissolve free hugetlb folios
> and lower nr_hugepages. Nothing records this, so when the pool shrinks
> it is hard to tell whether that or a write to nr_hugepages caused it.
Can we please have a much more detailed explanation of the motivation
for this? I assume it's for the benefit of ops people, but why do they
want this and how will it be used, etc? y'know, that old use-case
thing.
> Add an htlb_dissolve event, counted for each free folio that
> dissolve_free_hugetlb_folio() takes out of the pool.
I'm wondering why it doesn't account offline and memory-failure
separately but without the above info I'm at a loss!
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mm/hugetlb: add htlb_dissolve vmstat event
2026-11-05 19:15 [PATCH v2] mm/hugetlb: add htlb_dissolve vmstat event Mark Bundschuh
2026-11-05 23:39 ` Andrew Morton
@ 2026-11-06 3:50 ` Muchun Song
1 sibling, 0 replies; 3+ messages in thread
From: Muchun Song @ 2026-11-06 3:50 UTC (permalink / raw)
To: Mark Bundschuh
Cc: akpm, osalvador, David Hildenbrand, jiaqiyan, linux-mm, linux-kernel
> On Nov 6, 2026, at 03:15, Mark Bundschuh <mkbund@amazon.com> wrote:
>
> Memory offline and memory failure handling dissolve free hugetlb folios
> and lower nr_hugepages. Nothing records this, so when the pool shrinks
> it is hard to tell whether that or a write to nr_hugepages caused it.
Hi Mark,
I want to know why you need to distinguish these cases. Is it because,
in your scenario, there is a possibility that unexpected nr_hugepages
operations may modify things? You are not aware of such operational
actions, so you want to know whether you have experienced this kind of
operational action, is that right? Since this risk exists, why not use
auditctl to perform audit logging?
Thanks,
Muchun
>
> Add an htlb_dissolve event, counted for each free folio that
> dissolve_free_hugetlb_folio() takes out of the pool.
>
> Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
> ---
> v2: say "takes out of the pool" instead of "frees" (Jiaqi)
>
> v1: https://lore.kernel.org/all/20261105020324.2011790-1-mkbund@amazon.com/
>
> include/linux/vm_event_item.h | 1 +
> mm/hugetlb.c | 1 +
> mm/vmstat.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> index 2628ccda076a..822fe862e5b3 100644
> --- a/include/linux/vm_event_item.h
> +++ b/include/linux/vm_event_item.h
> @@ -71,6 +71,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
> #endif
> #ifdef CONFIG_HUGETLB_PAGE
> HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
> + HTLB_DISSOLVE,
> #endif
> #ifdef CONFIG_CMA
> CMA_ALLOC_SUCCESS,
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index da5d04edf7c1..7c79523b2a3c 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2047,6 +2047,7 @@ int dissolve_free_hugetlb_folio(struct folio *folio)
> }
>
> update_and_free_hugetlb_folio(h, folio, false);
> + count_vm_event(HTLB_DISSOLVE);
> return rc;
> }
> out:
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index a3e809c57f29..6282eef7074a 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1397,6 +1397,7 @@ const char * const vmstat_text[] = {
> #ifdef CONFIG_HUGETLB_PAGE
> [I(HTLB_BUDDY_PGALLOC)] = "htlb_buddy_alloc_success",
> [I(HTLB_BUDDY_PGALLOC_FAIL)] = "htlb_buddy_alloc_fail",
> + [I(HTLB_DISSOLVE)] = "htlb_dissolve",
> #endif
> #ifdef CONFIG_CMA
> [I(CMA_ALLOC_SUCCESS)] = "cma_alloc_success",
>
> base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-06 3:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 19:15 [PATCH v2] mm/hugetlb: add htlb_dissolve vmstat event Mark Bundschuh
2026-11-05 23:39 ` Andrew Morton
2026-11-06 3:50 ` Muchun Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®