Re: [PATCH] mm: fix LRU balancing effect of new transparent huge pages

From: Shakeel Butt
Date: Mon May 11 2020 - 17:38:38 EST


On Mon, May 11, 2020 at 2:11 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Sat, 9 May 2020 07:19:46 -0700 Shakeel Butt <shakeelb@xxxxxxxxxx> wrote:
>
> > Currently, THP are counted as single pages until they are split right
> > before being swapped out. However, at that point the VM is already in
> > the middle of reclaim, and adjusting the LRU balance then is useless.
> >
> > Always account THP by the number of basepages, and remove the fixup
> > from the splitting path.
>
> Confused. What kernel is this applicable to?

It is still applicable to the latest Linux kernel. Basically
lruvec->reclaim_stat->recent_[scanned|rotated] counters are used as
heuristic in get_scan_count() to measure how much file and anon LRUs
should be scanned by the current reclaim. Previously huge pages are
treated as single page while updating the recent_[scanned|rotated]
counters in swap.c while vmscan.c correctly updates them as huge
pages.