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

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

 



On Wed, May 19, 2021 at 09:33:13AM +0800, Huang Ying wrote:
> diff --git a/mm/memory.c b/mm/memory.c
> index b83f734c4e1d..2b6847f4c03e 100644
> --- a/mm/memory.c
> +++ 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);

If there are no more swap or pte references, can we just attempt to
free the page right away, like we do during regular unmap?

		if (page_copied)
			free_swap_cache(old_page);
		put_page(old_page);




[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