Re: [PATCH V4 4/6] mm: reclaim MADV_FREE pages

2017-02-24 Thread Minchan Kim
Hi Johannes, On Fri, Feb 24, 2017 at 10:36:55AM -0500, Johannes Weiner wrote: > On Fri, Feb 24, 2017 at 11:12:18AM +0900, Minchan Kim wrote: > > > @@ -1525,8 +1531,8 @@ int try_to_unmap(struct page *page, enum ttu_flags > > > flags) > > > > > > if (ret != SWAP_MLOCK && !page_mapcount(page)) {

Re: [PATCH V4 4/6] mm: reclaim MADV_FREE pages

2017-02-24 Thread Johannes Weiner
On Fri, Feb 24, 2017 at 11:12:18AM +0900, Minchan Kim wrote: > > @@ -1525,8 +1531,8 @@ int try_to_unmap(struct page *page, enum ttu_flags > > flags) > > > > if (ret != SWAP_MLOCK && !page_mapcount(page)) { > > ret = SWAP_SUCCESS; > > - if (rp.lazyfreed && !PageDirty(pag

Re: [PATCH V4 4/6] mm: reclaim MADV_FREE pages

2017-02-23 Thread Shaohua Li
On Fri, Feb 24, 2017 at 11:12:18AM +0900, Minchan Kim wrote: > On Wed, Feb 22, 2017 at 10:50:42AM -0800, Shaohua Li wrote: > > When memory pressure is high, we free MADV_FREE pages. If the pages are > > not dirty in pte, the pages could be freed immediately. Otherwise we > > can't reclaim them. We

Re: [PATCH V4 4/6] mm: reclaim MADV_FREE pages

2017-02-23 Thread Minchan Kim
On Wed, Feb 22, 2017 at 10:50:42AM -0800, Shaohua Li wrote: > When memory pressure is high, we free MADV_FREE pages. If the pages are > not dirty in pte, the pages could be freed immediately. Otherwise we > can't reclaim them. We put the pages back to anonumous LRU list (by > setting SwapBacked fla

Re: [PATCH V4 4/6] mm: reclaim MADV_FREE pages

2017-02-23 Thread Shaohua Li
On Thu, Feb 23, 2017 at 11:13:42AM -0500, Johannes Weiner wrote: > On Wed, Feb 22, 2017 at 10:50:42AM -0800, Shaohua Li wrote: > > @@ -1424,6 +1424,12 @@ static int try_to_unmap_one(struct page *page, > > struct vm_area_struct *vma, > > dec_mm_counter(mm, MM_ANONPAGES);

Re: [PATCH V4 4/6] mm: reclaim MADV_FREE pages

2017-02-23 Thread Johannes Weiner
On Wed, Feb 22, 2017 at 10:50:42AM -0800, Shaohua Li wrote: > @@ -1424,6 +1424,12 @@ static int try_to_unmap_one(struct page *page, struct > vm_area_struct *vma, > dec_mm_counter(mm, MM_ANONPAGES); > rp->lazyfreed++; >

[PATCH V4 4/6] mm: reclaim MADV_FREE pages

2017-02-22 Thread Shaohua Li
When memory pressure is high, we free MADV_FREE pages. If the pages are not dirty in pte, the pages could be freed immediately. Otherwise we can't reclaim them. We put the pages back to anonumous LRU list (by setting SwapBacked flag) and the pages will be reclaimed in normal swapout way. We use no