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

From: Rik van Riel
Date: Tue May 18 2021 - 22:12:55 EST


On Wed, 2021-05-19 at 09:33 +0800, Huang Ying wrote:

> To test the patch, we used pmbench memory accessing benchmark with
> working-set larger than available memory on a 2-socket Intel server
> with a NVMe SSD as swap device. Test results shows that the pmbench
> score increases up to 21.8% with the decreased size of swap cache and
> swapin throughput.

Nice!

> +++ b/mm/memory.c
> @@ -3012,6 +3012,11 @@ static vm_fault_t wp_page_copy(struct vm_fault
> *vmf)
> munlock_vma_page(old_page);
> unlock_page(old_page);
> }
> + if (page_copied && PageSwapCache(old_page) &&
> + !page_mapped(old_page) && trylock_page(old_page)) {
> + try_to_free_idle_swapcache(old_page);
> + unlock_page(old_page);
> + }

That's quite the if condition!

Would it make sense to move some of the tests, as well
as the trylock and unlock into try_to_free_idle_swapcache()
itself?

Especially considering that page_mapped is already tested
in that function, too...

> put_page(old_page);
> }



--
All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part