From: Johannes Weiner <hannes@cmpxchg.org>
To: Shakeel Butt <shakeelb@google.com>
Cc: "Huang Ying" <ying.huang@intel.com>,
"Tim Chen" <tim.c.chen@linux.intel.com>,
"Michal Hocko" <mhocko@kernel.org>,
"Greg Thelen" <gthelen@google.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Balbir Singh" <bsingharora@gmail.com>,
"Minchan Kim" <minchan@kernel.org>, "Shaohua Li" <shli@fb.com>,
"Jérôme Glisse" <jglisse@redhat.com>, "Jan Kara" <jack@suse.cz>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Dan Williams" <dan.j.williams@intel.com>,
"Mel Gorman" <mgorman@suse.de>, "Hugh Dickins" <hughd@google.com>,
"Vlastimil Babka" <vbabka@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm, mlock, vmscan: no more skipping pagevecs
Date: Tue, 21 Nov 2017 10:32:57 -0500 [thread overview]
Message-ID: <20171121153257.GA23920@cmpxchg.org> (raw)
In-Reply-To: <20171104224312.145616-1-shakeelb@google.com>
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.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: Shakeel Butt <shakeelb@google.com>
Cc: "Huang Ying" <ying.huang@intel.com>,
"Tim Chen" <tim.c.chen@linux.intel.com>,
"Michal Hocko" <mhocko@kernel.org>,
"Greg Thelen" <gthelen@google.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Balbir Singh" <bsingharora@gmail.com>,
"Minchan Kim" <minchan@kernel.org>, "Shaohua Li" <shli@fb.com>,
"Jérôme Glisse" <jglisse@redhat.com>, "Jan Kara" <jack@suse.cz>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Dan Williams" <dan.j.williams@intel.com>,
"Mel Gorman" <mgorman@suse.de>, "Hugh Dickins" <hughd@google.com>,
"Vlastimil Babka" <vbabka@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm, mlock, vmscan: no more skipping pagevecs
Date: Tue, 21 Nov 2017 10:32:57 -0500 [thread overview]
Message-ID: <20171121153257.GA23920@cmpxchg.org> (raw)
In-Reply-To: <20171104224312.145616-1-shakeelb@google.com>
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.
next prev parent reply other threads:[~2017-11-21 15:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-04 22:43 [PATCH] mm, mlock, vmscan: no more skipping pagevecs Shakeel Butt
2017-11-04 22:43 ` Shakeel Butt
2017-11-16 1:45 ` Shakeel Butt
2017-11-16 1:45 ` Shakeel Butt
2017-11-21 12:39 ` Vlastimil Babka
2017-11-21 12:39 ` Vlastimil Babka
2017-11-21 15:06 ` Johannes Weiner
2017-11-21 15:06 ` Johannes Weiner
2017-11-21 17:13 ` Shakeel Butt
2017-11-21 17:13 ` Shakeel Butt
2017-11-21 18:22 ` Shakeel Butt
2017-11-21 18:22 ` Shakeel Butt
2017-11-21 21:34 ` Johannes Weiner
2017-11-21 21:34 ` Johannes Weiner
2017-11-21 15:32 ` Johannes Weiner [this message]
2017-11-21 15:32 ` Johannes Weiner
2017-11-21 17:20 ` Shakeel Butt
2017-11-21 17:20 ` Shakeel Butt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171121153257.GA23920@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=bsingharora@gmail.com \
--cc=dan.j.williams@intel.com \
--cc=gthelen@google.com \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=npiggin@gmail.com \
--cc=shakeelb@google.com \
--cc=shli@fb.com \
--cc=tim.c.chen@linux.intel.com \
--cc=vbabka@suse.cz \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.