Re: [PATCH] mm: move idle swap cache pages to the tail of LRU after COW

From: Linus Torvalds
Date: Tue May 18 2021 - 23:17:44 EST


On Tue, May 18, 2021 at 3:33 PM Huang Ying <ying.huang@xxxxxxxxx> wrote:
>
> With commit 09854ba94c6a ("mm: do_wp_page() simplification"), after
> COW, the idle swap cache (neither the page nor the corresponding swap
> entry is mapped by any process) will be left at the original position
> in the LRU list. While it may be in the active list or the head of
> the inactive list, so that vmscan may take more overhead or time to
> reclaim these actually unused pages.

This looks sensible to me (and numbers talk!), but as Rik says, it
would probably be a good idea to move the trylock_page()/unlock_page()
into try_to_free_idle_swapcache(), and that would make the calling
side a whole lot cleaner and easier to read.

Linus