lkml.org 
[lkml]   [2022]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: vmscan: split khugepaged stats from direct reclaim stats
On Tue, Oct 25, 2022 at 06:16:53PM +0100, Matthew Wilcox wrote:
> On Tue, Oct 25, 2022 at 01:05:19PM -0400, Johannes Weiner wrote:
> > +static int reclaimer_offset(void)
> > +{
> > + BUILD_BUG_ON(PGSTEAL_DIRECT - PGSTEAL_KSWAPD != 1);
> > + BUILD_BUG_ON(PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD != 2);
> > + BUILD_BUG_ON(PGDEMOTE_DIRECT - PGDEMOTE_KSWAPD != 1);
> > + BUILD_BUG_ON(PGDEMOTE_KHUGEPAGED - PGDEMOTE_KSWAPD != 2);
> > + BUILD_BUG_ON(PGSCAN_DIRECT - PGSCAN_KSWAPD != 1);
> > + BUILD_BUG_ON(PGSCAN_KHUGEPAGED - PGSCAN_KSWAPD != 2);
> > +
> > + if (current_is_kswapd())
> > + return 0;
> > + if (current_is_khugepaged())
> > + return 2;
> > + return 1;
> > +}
>
> Would this be simpler as ...
>
> BUILD_BUG_ON(PGSTEAL_DIRECT - PGSTEAL_KSWAPD !=
> PGDEMOTE_DIRECT - PGDEMOTE_KSWAPD);
> BUILD_BUG_ON(PGSTEAL_DIRECT - PGSTEAL_KSWAPD !=
> PGSCAN_DIRECT - PGSCAN_KSWAPD);
> BUILD_BUG_ON(PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD !=
> PGDEMOTE_KHUGEPAGED - PGDEMOTE_KSWAPD);
> BUILD_BUG_ON(PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD !=
> PGSCAN_KHUGEPAGED - PGDEMOTE_KSWAPD);
>
> if (current_is_kswapd())
> return 0;
> if (current_is_khugepaged())
> return PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD;
> return PGSTEAL_DIRECT - PGSTEAL_KSWAPD;
>
> Not that I think we'd ever want to separate them, but it is perhaps a
> bit less magic?

Yeah that looks better. I'll do that in v2, thanks!

\
 
 \ /
  Last update: 2022-10-25 22:44    [W:0.098 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site