include/linux/huge_mm.h | 21 +++++++++++++++++ mm/huge_memory.c | 52 +++++++++++++++++++++++++++++++++++++++++ mm/memory.c | 2 ++ mm/page_io.c | 6 ++++- mm/vmscan.c | 3 +++ 5 files changed, 83 insertions(+), 1 deletion(-)
From: Barry Song <v-songbaohua@oppo.com>
The patchset introduces a framework to facilitate mTHP counters, starting
with the allocation and swap-out counters. Currently, only four new nodes
are appended to the stats directory for each mTHP size.
/sys/kernel/mm/transparent_hugepage/hugepages-<size>/stats
anon_alloc
anon_alloc_fallback
anon_swpout
anon_swpout_fallback
These four nodes are crucial for us to monitor the fragmentation levels of
both the buddy system and the swapfile. In the future, we may consider
adding additional nodes for further insights.
-v4:
* Many thanks to David and Ryan for your patience and valuable insights
throughout the numerous renaming efforts!
* Guard the case order > PMD_ORDER in count func rather than in callers,
Ryan;
* Add swpout counters;
* Add a helper DEFINE_MTHP_STAT_ATTR to avoid code duplication for various
counters;
-v3:
https://lore.kernel.org/linux-mm/20240403035502.71356-1-21cnbao@gmail.com/
Barry Song (2):
mm: add per-order mTHP anon_alloc and anon_alloc_fallback counters
mm: add per-order mTHP anon_swpout and anon_swpout_fallback counters
include/linux/huge_mm.h | 21 +++++++++++++++++
mm/huge_memory.c | 52 +++++++++++++++++++++++++++++++++++++++++
mm/memory.c | 2 ++
mm/page_io.c | 6 ++++-
mm/vmscan.c | 3 +++
5 files changed, 83 insertions(+), 1 deletion(-)
--
2.34.1
On Fri, 5 Apr 2024 23:27:02 +1300 Barry Song <21cnbao@gmail.com> wrote: > The patchset introduces a framework to facilitate mTHP counters, starting > with the allocation and swap-out counters. Currently, only four new nodes > are appended to the stats directory for each mTHP size. > > /sys/kernel/mm/transparent_hugepage/hugepages-<size>/stats > anon_alloc > anon_alloc_fallback > anon_swpout > anon_swpout_fallback Please let's get these documented? Documentation/admin-guide/mm/transhuge.rst seems to be the place, and under Documentation/ABI.
On Sat, Apr 6, 2024 at 9:11 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Fri, 5 Apr 2024 23:27:02 +1300 Barry Song <21cnbao@gmail.com> wrote:
>
> > The patchset introduces a framework to facilitate mTHP counters, starting
> > with the allocation and swap-out counters. Currently, only four new nodes
> > are appended to the stats directory for each mTHP size.
> >
> > /sys/kernel/mm/transparent_hugepage/hugepages-<size>/stats
> > anon_alloc
> > anon_alloc_fallback
> > anon_swpout
> > anon_swpout_fallback
>
> Please let's get these documented?
Sure, I will do it.
Furthermore, after careful consideration, I suggest renaming anon_alloc to
anon_fault_alloc and anon_alloc_fallback to anon_fault_fallback. This
renaming is consistent with the naming convention observed in
thp_fault_alloc and thp_fault_fallback in vmstat. Additionally, this
modification will facilitate the handling of large folio swap-ins.
/sys/kernel/mm/transparent_hugepage/hugepages-<size>/stats
anon_fault_alloc,
anon_fault_fallback,
anon_swpin_alloc,
anon_swpin_fallback,
Otherwise, without this renaming, it would be difficult to
differentiate fault_alloc
from swpin_alloc.
Hi David, Ryan,
I would also appreciate your input on the modification I am considering.
> Documentation/admin-guide/mm/transhuge.rst seems to be the place, and
> under Documentation/ABI.
Thanks
Barry
On 05/04/2024 23:04, Barry Song wrote: > On Sat, Apr 6, 2024 at 9:11 AM Andrew Morton <akpm@linux-foundation.org> wrote: >> >> On Fri, 5 Apr 2024 23:27:02 +1300 Barry Song <21cnbao@gmail.com> wrote: >> >>> The patchset introduces a framework to facilitate mTHP counters, starting >>> with the allocation and swap-out counters. Currently, only four new nodes >>> are appended to the stats directory for each mTHP size. >>> >>> /sys/kernel/mm/transparent_hugepage/hugepages-<size>/stats >>> anon_alloc >>> anon_alloc_fallback >>> anon_swpout >>> anon_swpout_fallback >> >> Please let's get these documented? > > Sure, I will do it. > > Furthermore, after careful consideration, I suggest renaming anon_alloc to > anon_fault_alloc and anon_alloc_fallback to anon_fault_fallback. This > renaming is consistent with the naming convention observed in > thp_fault_alloc and thp_fault_fallback in vmstat. Additionally, this > modification will facilitate the handling of large folio swap-ins. > > /sys/kernel/mm/transparent_hugepage/hugepages-<size>/stats > anon_fault_alloc, > anon_fault_fallback, > anon_swpin_alloc, > anon_swpin_fallback, > > Otherwise, without this renaming, it would be difficult to > differentiate fault_alloc > from swpin_alloc. > > Hi David, Ryan, > I would also appreciate your input on the modification I am considering. Yes, this makes sense to me! > >> Documentation/admin-guide/mm/transhuge.rst seems to be the place, and >> under Documentation/ABI. > > Thanks > Barry
© 2016 - 2025 Red Hat, Inc.