Re: [PATCH] mm: vmscan: split khugepaged stats from direct reclaim stats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux