linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm: drop the 'anon_' prefix for swap-out mTHP counters
@ 2024-05-23  2:36 Baolin Wang
  2024-05-23  3:21 ` Barry Song
  0 siblings, 1 reply; 2+ messages in thread
From: Baolin Wang @ 2024-05-23  2:36 UTC (permalink / raw)
  To: akpm
  Cc: willy, david, ying.huang, 21cnbao, ryan.roberts, ziy, ioworker0,
	baolin.wang, linux-mm, linux-kernel

The mTHP swap related counters: 'anon_swpout' and 'anon_swpout_fallback' are
confusing with an 'anon_' prefix, since the shmem can swap out non-anonymous
pages. So drop the 'anon_' prefix to keep consistent with the old swap counter
names.

Suggested-by: "Huang, Ying" <ying.huang@intel.com>
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
Hi Andrew,

Hope this patch can be merged into kernel 6.10-rc to maintain ABI compatibility.
Thanks.

Changes from v1:
 - Update the documentation per Barry Song.
---
 Documentation/admin-guide/mm/transhuge.rst | 4 ++--
 include/linux/huge_mm.h                    | 4 ++--
 mm/huge_memory.c                           | 8 ++++----
 mm/page_io.c                               | 2 +-
 mm/vmscan.c                                | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst
index 076443cc10a6..d414d3f5592a 100644
--- a/Documentation/admin-guide/mm/transhuge.rst
+++ b/Documentation/admin-guide/mm/transhuge.rst
@@ -467,11 +467,11 @@ anon_fault_fallback_charge
 	instead falls back to using huge pages with lower orders or
 	small pages even though the allocation was successful.
 
-anon_swpout
+swpout
 	is incremented every time a huge page is swapped out in one
 	piece without splitting.
 
-anon_swpout_fallback
+swpout_fallback
 	is incremented if a huge page has to be split before swapout.
 	Usually because failed to allocate some continuous swap space
 	for the huge page.
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index c8d3ec116e29..8c72d3786583 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -269,8 +269,8 @@ enum mthp_stat_item {
 	MTHP_STAT_ANON_FAULT_ALLOC,
 	MTHP_STAT_ANON_FAULT_FALLBACK,
 	MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE,
-	MTHP_STAT_ANON_SWPOUT,
-	MTHP_STAT_ANON_SWPOUT_FALLBACK,
+	MTHP_STAT_SWPOUT,
+	MTHP_STAT_SWPOUT_FALLBACK,
 	__MTHP_STAT_COUNT
 };
 
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 317de2afd371..89932fd0f62e 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -558,15 +558,15 @@ static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
 DEFINE_MTHP_STAT_ATTR(anon_fault_alloc, MTHP_STAT_ANON_FAULT_ALLOC);
 DEFINE_MTHP_STAT_ATTR(anon_fault_fallback, MTHP_STAT_ANON_FAULT_FALLBACK);
 DEFINE_MTHP_STAT_ATTR(anon_fault_fallback_charge, MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE);
-DEFINE_MTHP_STAT_ATTR(anon_swpout, MTHP_STAT_ANON_SWPOUT);
-DEFINE_MTHP_STAT_ATTR(anon_swpout_fallback, MTHP_STAT_ANON_SWPOUT_FALLBACK);
+DEFINE_MTHP_STAT_ATTR(swpout, MTHP_STAT_SWPOUT);
+DEFINE_MTHP_STAT_ATTR(swpout_fallback, MTHP_STAT_SWPOUT_FALLBACK);
 
 static struct attribute *stats_attrs[] = {
 	&anon_fault_alloc_attr.attr,
 	&anon_fault_fallback_attr.attr,
 	&anon_fault_fallback_charge_attr.attr,
-	&anon_swpout_attr.attr,
-	&anon_swpout_fallback_attr.attr,
+	&swpout_attr.attr,
+	&swpout_fallback_attr.attr,
 	NULL,
 };
 
diff --git a/mm/page_io.c b/mm/page_io.c
index 46c603dddf04..0a150c240bf4 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -217,7 +217,7 @@ static inline void count_swpout_vm_event(struct folio *folio)
 		count_memcg_folio_events(folio, THP_SWPOUT, 1);
 		count_vm_event(THP_SWPOUT);
 	}
-	count_mthp_stat(folio_order(folio), MTHP_STAT_ANON_SWPOUT);
+	count_mthp_stat(folio_order(folio), MTHP_STAT_SWPOUT);
 #endif
 	count_vm_events(PSWPOUT, folio_nr_pages(folio));
 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 6981a71c8ef0..18b796605aa5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1244,7 +1244,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
 							THP_SWPOUT_FALLBACK, 1);
 						count_vm_event(THP_SWPOUT_FALLBACK);
 					}
-					count_mthp_stat(order, MTHP_STAT_ANON_SWPOUT_FALLBACK);
+					count_mthp_stat(order, MTHP_STAT_SWPOUT_FALLBACK);
 #endif
 					if (!add_to_swap(folio))
 						goto activate_locked_split;
-- 
2.39.3



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mm: drop the 'anon_' prefix for swap-out mTHP counters
  2024-05-23  2:36 [PATCH v2] mm: drop the 'anon_' prefix for swap-out mTHP counters Baolin Wang
@ 2024-05-23  3:21 ` Barry Song
  0 siblings, 0 replies; 2+ messages in thread
From: Barry Song @ 2024-05-23  3:21 UTC (permalink / raw)
  To: Baolin Wang
  Cc: akpm, willy, david, ying.huang, ryan.roberts, ziy, ioworker0,
	linux-mm, linux-kernel

On Thu, May 23, 2024 at 2:37 PM Baolin Wang
<baolin.wang@linux.alibaba.com> wrote:
>
> The mTHP swap related counters: 'anon_swpout' and 'anon_swpout_fallback' are
> confusing with an 'anon_' prefix, since the shmem can swap out non-anonymous
> pages. So drop the 'anon_' prefix to keep consistent with the old swap counter
> names.
>
> Suggested-by: "Huang, Ying" <ying.huang@intel.com>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>

Acked-by: Barry Song <baohua@kernel.org>

> ---
> Hi Andrew,
>
> Hope this patch can be merged into kernel 6.10-rc to maintain ABI compatibility.
> Thanks.
>
> Changes from v1:
>  - Update the documentation per Barry Song.
> ---
>  Documentation/admin-guide/mm/transhuge.rst | 4 ++--
>  include/linux/huge_mm.h                    | 4 ++--
>  mm/huge_memory.c                           | 8 ++++----
>  mm/page_io.c                               | 2 +-
>  mm/vmscan.c                                | 2 +-
>  5 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst
> index 076443cc10a6..d414d3f5592a 100644
> --- a/Documentation/admin-guide/mm/transhuge.rst
> +++ b/Documentation/admin-guide/mm/transhuge.rst
> @@ -467,11 +467,11 @@ anon_fault_fallback_charge
>         instead falls back to using huge pages with lower orders or
>         small pages even though the allocation was successful.
>
> -anon_swpout
> +swpout
>         is incremented every time a huge page is swapped out in one
>         piece without splitting.
>
> -anon_swpout_fallback
> +swpout_fallback
>         is incremented if a huge page has to be split before swapout.
>         Usually because failed to allocate some continuous swap space
>         for the huge page.
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index c8d3ec116e29..8c72d3786583 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -269,8 +269,8 @@ enum mthp_stat_item {
>         MTHP_STAT_ANON_FAULT_ALLOC,
>         MTHP_STAT_ANON_FAULT_FALLBACK,
>         MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE,
> -       MTHP_STAT_ANON_SWPOUT,
> -       MTHP_STAT_ANON_SWPOUT_FALLBACK,
> +       MTHP_STAT_SWPOUT,
> +       MTHP_STAT_SWPOUT_FALLBACK,
>         __MTHP_STAT_COUNT
>  };
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 317de2afd371..89932fd0f62e 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -558,15 +558,15 @@ static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
>  DEFINE_MTHP_STAT_ATTR(anon_fault_alloc, MTHP_STAT_ANON_FAULT_ALLOC);
>  DEFINE_MTHP_STAT_ATTR(anon_fault_fallback, MTHP_STAT_ANON_FAULT_FALLBACK);
>  DEFINE_MTHP_STAT_ATTR(anon_fault_fallback_charge, MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE);
> -DEFINE_MTHP_STAT_ATTR(anon_swpout, MTHP_STAT_ANON_SWPOUT);
> -DEFINE_MTHP_STAT_ATTR(anon_swpout_fallback, MTHP_STAT_ANON_SWPOUT_FALLBACK);
> +DEFINE_MTHP_STAT_ATTR(swpout, MTHP_STAT_SWPOUT);
> +DEFINE_MTHP_STAT_ATTR(swpout_fallback, MTHP_STAT_SWPOUT_FALLBACK);
>
>  static struct attribute *stats_attrs[] = {
>         &anon_fault_alloc_attr.attr,
>         &anon_fault_fallback_attr.attr,
>         &anon_fault_fallback_charge_attr.attr,
> -       &anon_swpout_attr.attr,
> -       &anon_swpout_fallback_attr.attr,
> +       &swpout_attr.attr,
> +       &swpout_fallback_attr.attr,
>         NULL,
>  };
>
> diff --git a/mm/page_io.c b/mm/page_io.c
> index 46c603dddf04..0a150c240bf4 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -217,7 +217,7 @@ static inline void count_swpout_vm_event(struct folio *folio)
>                 count_memcg_folio_events(folio, THP_SWPOUT, 1);
>                 count_vm_event(THP_SWPOUT);
>         }
> -       count_mthp_stat(folio_order(folio), MTHP_STAT_ANON_SWPOUT);
> +       count_mthp_stat(folio_order(folio), MTHP_STAT_SWPOUT);
>  #endif
>         count_vm_events(PSWPOUT, folio_nr_pages(folio));
>  }
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 6981a71c8ef0..18b796605aa5 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1244,7 +1244,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>                                                         THP_SWPOUT_FALLBACK, 1);
>                                                 count_vm_event(THP_SWPOUT_FALLBACK);
>                                         }
> -                                       count_mthp_stat(order, MTHP_STAT_ANON_SWPOUT_FALLBACK);
> +                                       count_mthp_stat(order, MTHP_STAT_SWPOUT_FALLBACK);
>  #endif
>                                         if (!add_to_swap(folio))
>                                                 goto activate_locked_split;
> --
> 2.39.3
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-23  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-23  2:36 [PATCH v2] mm: drop the 'anon_' prefix for swap-out mTHP counters Baolin Wang
2024-05-23  3:21 ` Barry Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox