Messages in this thread | | | Date | Mon, 13 Feb 2017 14:06:36 +0900 | From | Minchan Kim <> | Subject | Re: [PATCH V2 3/7] mm: reclaim MADV_FREE pages |
| |
On Fri, Feb 10, 2017 at 09:43:07AM -0800, Shaohua Li wrote:
< snip >
> > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > index 947ab6f..b304a84 100644 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -864,7 +864,7 @@ static enum page_references page_check_references(struct page *page, > > > return PAGEREF_RECLAIM; > > > > > > if (referenced_ptes) { > > > - if (PageSwapBacked(page)) > > > + if (PageSwapBacked(page) || PageAnon(page)) > > > > If anyone accesses MADV_FREEed range with load op, not store, > > why shouldn't we discard that pages? > > Don't have strong opinion about this, userspace probably shouldn't do this. I'm > ok to delete it if you insist.
Yes, I prefer to removing unnecessary code unless there is a some reaason.
> > > > return PAGEREF_ACTIVATE; > > > /* > > > * All mapped pages start out with page table
< snip >
> > > @@ -971,7 +971,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, > > > int may_enter_fs; > > > enum page_references references = PAGEREF_RECLAIM_CLEAN; > > > bool dirty, writeback; > > > - bool lazyfree = false; > > > + bool lazyfree; > > > int ret = SWAP_SUCCESS; > > > > > > cond_resched(); > > > @@ -986,6 +986,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, > > > > > > sc->nr_scanned++; > > > > > > + lazyfree = page_is_lazyfree(page); > > > + > > > if (unlikely(!page_evictable(page))) > > > goto cull_mlocked; > > > > > > @@ -993,7 +995,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, > > > goto keep_locked; > > > > > > /* Double the slab pressure for mapped and swapcache pages */ > > > - if (page_mapped(page) || PageSwapCache(page)) > > > + if ((page_mapped(page) || PageSwapCache(page)) && !lazyfree) > > > sc->nr_scanned++; > > > > In this phase, we cannot know whether lazyfree marked page is discarable > > or not. If it is freeable and mapped, this logic makes sense. However, > > if the page is dirty? > > I think this doesn't matter. If the page is dirty, it will go to reclaim in > next round and swap out. At that time, we will add nr_scanned there.
If the lazyfree page in LRU comes around again into this, it's true but the page could be freed before that. Having said that, I don't know how critical it is and what kinds of rationale was to push slab reclaim so I don't insist on it.
Thanks.
| |