Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP
From: Yafang Shao
Date: Sat May 11 2019 - 00:11:42 EST
On Sat, May 11, 2019 at 12:36 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote:
> > > + nr_reclaimed += (1 << compound_order(page));
> > How about to change this to
> > nr_reclaimed += hpage_nr_pages(page);
> Please don't. That embeds the knowledge that we can only swap out either
> normal pages or THP sized pages.
compound_order() is more general than hpage_nr_pages().
It seems to me that hpage_nr_pages() is a little abuse in lots of places.