Re: [PATCH] mm: Free unused swap cache page in write protection fault handler

2021-01-15 Thread Huang, Ying
Linus Torvalds writes: > On Tue, Jan 12, 2021 at 9:24 PM huang ying > wrote: >> > >> > Couldn't we just move it to the tail of the LRU list so it's reclaimed >> > first? Or is locking going to be a problem here? >> >> Yes. That's a way to reduce the disturbance to the page reclaiming. >> For

Re: [PATCH] mm: Free unused swap cache page in write protection fault handler

2021-01-13 Thread Linus Torvalds
On Tue, Jan 12, 2021 at 9:24 PM huang ying wrote: > > > > Couldn't we just move it to the tail of the LRU list so it's reclaimed > > first? Or is locking going to be a problem here? > > Yes. That's a way to reduce the disturbance to the page reclaiming. > For LRU lock contention, is it

Re: [PATCH] mm: Free unused swap cache page in write protection fault handler

2021-01-12 Thread huang ying
On Wed, Jan 13, 2021 at 11:12 AM Matthew Wilcox wrote: > > On Wed, Jan 13, 2021 at 11:08:56AM +0800, huang ying wrote: > > On Wed, Jan 13, 2021 at 10:47 AM Linus Torvalds > > wrote: > > > > > > On Tue, Jan 12, 2021 at 6:43 PM Huang Ying wrote: > > > > > > > > So in this patch, at the end of

Re: [PATCH] mm: Free unused swap cache page in write protection fault handler

2021-01-12 Thread Matthew Wilcox
On Wed, Jan 13, 2021 at 11:08:56AM +0800, huang ying wrote: > On Wed, Jan 13, 2021 at 10:47 AM Linus Torvalds > wrote: > > > > On Tue, Jan 12, 2021 at 6:43 PM Huang Ying wrote: > > > > > > So in this patch, at the end of wp_page_copy(), the old unused swap > > > cache page will be tried to be

Re: [PATCH] mm: Free unused swap cache page in write protection fault handler

2021-01-12 Thread huang ying
On Wed, Jan 13, 2021 at 10:47 AM Linus Torvalds wrote: > > On Tue, Jan 12, 2021 at 6:43 PM Huang Ying wrote: > > > > So in this patch, at the end of wp_page_copy(), the old unused swap > > cache page will be tried to be freed. > > I'd much rather free it later when needed, rather than when

Re: [PATCH] mm: Free unused swap cache page in write protection fault handler

2021-01-12 Thread Linus Torvalds
On Tue, Jan 12, 2021 at 6:43 PM Huang Ying wrote: > > So in this patch, at the end of wp_page_copy(), the old unused swap > cache page will be tried to be freed. I'd much rather free it later when needed, rather than when you're in a COW section. Linus

[PATCH] mm: Free unused swap cache page in write protection fault handler

2021-01-12 Thread Huang Ying
Commit 09854ba94c6a ("mm: do_wp_page() simplification") introduces an issue as follows. On a system with free memory as follow before test, totalusedfree shared buff/cache available Mem:1697300 160156 14592208648 77924