lkml.org 
[lkml]   [2017]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm, mlock, vmscan: no more skipping pagevecs
On Sat, Nov 04, 2017 at 03:43:12PM -0700, Shakeel Butt wrote:
> When a thread mlocks an address space backed by file, a new
> page is allocated (assuming file page is not in memory), added
> to the local pagevec (lru_add_pvec), I/O is triggered and the
> thread then sleeps on the page. On I/O completion, the thread
> can wake on a different CPU, the mlock syscall will then sets
> the PageMlocked() bit of the page but will not be able to put
> that page in unevictable LRU as the page is on the pagevec of
> a different CPU. Even on drain, that page will go to evictable
> LRU because the PageMlocked() bit is not checked on pagevec
> drain.
>
> The page will eventually go to right LRU on reclaim but the
> LRU stats will remain skewed for a long time.
>
> However, this issue does not happen for anon pages on swap
> because unlike file pages, anon pages are not added to pagevec
> until they have been fully swapped in.

How so? __read_swap_cache_async() is the core function that allocates
the page, and that always puts the page on the pagevec before IO is
initiated.

> Also the fault handler uses vm_flags to set the PageMlocked() bit of
> such anon pages even before returning to mlock() syscall and mlocked
> pages will skip pagevecs and directly be put into unevictable LRU.

Where does the swap fault path set PageMlocked()?

I might just be missing something.

\
 
 \ /
  Last update: 2017-11-21 16:33    [W:0.105 / U:6.548 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site