[PATCH v1] mm: swap: Call count_mthp_stat() outside ifdef CONFIG_TRANSPARENT_HUGEPAGE.

Kanchana P Sridhar posted 1 patch 1 month, 3 weeks ago
There is a newer version of this series
mm/page_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] mm: swap: Call count_mthp_stat() outside ifdef CONFIG_TRANSPARENT_HUGEPAGE.
Posted by Kanchana P Sridhar 1 month, 3 weeks ago
This patch moves the call to count_mthp_stat() in count_swpout_vm_event()
to be outside the "ifdef CONFIG_TRANSPARENT_HUGEPAGE" based on changes
made in commit 246d3aa3e53151fa150f10257ddd8a4facd31a6a ("mm: cleanup
 count_mthp_stat() definition").

Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
---
 mm/page_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_io.c b/mm/page_io.c
index 4aa34862676f..a28d28b6b3ce 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -289,8 +289,8 @@ 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_SWPOUT);
 #endif
+	count_mthp_stat(folio_order(folio), MTHP_STAT_SWPOUT);
 	count_memcg_folio_events(folio, PSWPOUT, folio_nr_pages(folio));
 	count_vm_events(PSWPOUT, folio_nr_pages(folio));
 }
-- 
2.27.0
Re: [PATCH v1] mm: swap: Call count_mthp_stat() outside ifdef CONFIG_TRANSPARENT_HUGEPAGE.
Posted by Yosry Ahmed 1 month, 3 weeks ago
On Wed, Oct 2, 2024 at 10:30 AM Kanchana P Sridhar
<kanchana.p.sridhar@intel.com> wrote:
>
> This patch moves the call to count_mthp_stat() in count_swpout_vm_event()
> to be outside the "ifdef CONFIG_TRANSPARENT_HUGEPAGE" based on changes
> made in commit 246d3aa3e53151fa150f10257ddd8a4facd31a6a ("mm: cleanup
>  count_mthp_stat() definition").
>
> Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>


I don't think this really makes a difference, but I will leave it to
the THP folks to decide.

However, if you go through with this, please also do the same for the
call in shrink_folio_list() for consistency.

>
> ---
>  mm/page_io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_io.c b/mm/page_io.c
> index 4aa34862676f..a28d28b6b3ce 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -289,8 +289,8 @@ 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_SWPOUT);
>  #endif
> +       count_mthp_stat(folio_order(folio), MTHP_STAT_SWPOUT);
>         count_memcg_folio_events(folio, PSWPOUT, folio_nr_pages(folio));
>         count_vm_events(PSWPOUT, folio_nr_pages(folio));
>  }
> --
> 2.27.0
>
RE: [PATCH v1] mm: swap: Call count_mthp_stat() outside ifdef CONFIG_TRANSPARENT_HUGEPAGE.
Posted by Sridhar, Kanchana P 1 month, 3 weeks ago
> -----Original Message-----
> From: Yosry Ahmed <yosryahmed@google.com>
> Sent: Wednesday, October 2, 2024 12:02 PM
> To: Sridhar, Kanchana P <kanchana.p.sridhar@intel.com>
> Cc: linux-kernel@vger.kernel.org; linux-mm@kvack.org;
> hannes@cmpxchg.org; nphamcs@gmail.com; chengming.zhou@linux.dev;
> ryan.roberts@arm.com; Huang, Ying <ying.huang@intel.com>;
> 21cnbao@gmail.com; akpm@linux-foundation.org; Feghali, Wajdi K
> <wajdi.k.feghali@intel.com>; Gopal, Vinodh <vinodh.gopal@intel.com>
> Subject: Re: [PATCH v1] mm: swap: Call count_mthp_stat() outside ifdef
> CONFIG_TRANSPARENT_HUGEPAGE.
> 
> On Wed, Oct 2, 2024 at 10:30 AM Kanchana P Sridhar
> <kanchana.p.sridhar@intel.com> wrote:
> >
> > This patch moves the call to count_mthp_stat() in
> count_swpout_vm_event()
> > to be outside the "ifdef CONFIG_TRANSPARENT_HUGEPAGE" based on
> changes
> > made in commit 246d3aa3e53151fa150f10257ddd8a4facd31a6a ("mm:
> cleanup
> >  count_mthp_stat() definition").
> >
> > Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
> 
> 
> I don't think this really makes a difference, but I will leave it to
> the THP folks to decide.

Sure, this makes sense.

> 
> However, if you go through with this, please also do the same for the
> call in shrink_folio_list() for consistency.

Yes, will submit v2 with the same modification in shrink_folio_list().

Thanks,
Kanchana

> 
> >
> > ---
> >  mm/page_io.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/page_io.c b/mm/page_io.c
> > index 4aa34862676f..a28d28b6b3ce 100644
> > --- a/mm/page_io.c
> > +++ b/mm/page_io.c
> > @@ -289,8 +289,8 @@ 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_SWPOUT);
> >  #endif
> > +       count_mthp_stat(folio_order(folio), MTHP_STAT_SWPOUT);
> >         count_memcg_folio_events(folio, PSWPOUT, folio_nr_pages(folio));
> >         count_vm_events(PSWPOUT, folio_nr_pages(folio));
> >  }
> > --
> > 2.27.0
> >
Re: [PATCH v1] mm: swap: Call count_mthp_stat() outside ifdef CONFIG_TRANSPARENT_HUGEPAGE.
Posted by Nhat Pham 1 month, 3 weeks ago
On Wed, Oct 2, 2024 at 10:30 AM Kanchana P Sridhar
<kanchana.p.sridhar@intel.com> wrote:
>
> This patch moves the call to count_mthp_stat() in count_swpout_vm_event()
> to be outside the "ifdef CONFIG_TRANSPARENT_HUGEPAGE" based on changes
> made in commit 246d3aa3e53151fa150f10257ddd8a4facd31a6a ("mm: cleanup
>  count_mthp_stat() definition").
>
> Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>

Reviewed-by: Nhat Pham <nphamcs@gmail.com>