Re: mlock: mlocked pages are unevictable

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Lee Schermerhorn
Date: Wednesday, October 22, 2008 - 8:28 am

On Tue, 2008-10-21 at 17:13 +0200, Heiko Carstens wrote:
<snip>


We could probably remove the lru_add_drain_all() called from
__mlock_vma_pages_range(), or replace it with a local lru_add_drain().
It's only there to push pages that might still be in the lru pagevecs
out to the lru lists so that we can isolate them and move them to the
the unevictable list.  The local lru_drain() should push any pages
faulted in by the immediately prior call to get_user_pages().  The only
pages we'd miss would be pages [recently?] faulted on another processor
and still in that pagevec.  So, we'll have a page marked as mlocked on a
normal lru list.  If/when vmscan sees it, it will immediately move it to
the unevictable lru list.

The call to lru_add_drain_all() from __clear_page_mlock() may be more
difficult.  Rik added that during testing because we found race
conditions--during COW in the fault path, IIRC--where we would strand an
mlocked page on the unevictable list.  It's an unlikely situation, I
think.  We were beating on COWing of mlocked pages--mlockall(); fork();
child attempts write to shared anon page, mlocked by parent;
munlockall()/exit() from parent--pretty heavily at the time.

Lee


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: mlock: mlocked pages are unevictable, Heiko Carstens, (Tue Oct 21, 8:13 am)
Re: mlock: mlocked pages are unevictable, KOSAKI Motohiro, (Tue Oct 21, 8:51 am)
Re: mlock: mlocked pages are unevictable, KOSAKI Motohiro, (Tue Oct 21, 10:18 am)
Re: mlock: mlocked pages are unevictable, Peter Zijlstra, (Tue Oct 21, 1:30 pm)
Re: mlock: mlocked pages are unevictable, Peter Zijlstra, (Tue Oct 21, 1:48 pm)
Re: mlock: mlocked pages are unevictable, Lee Schermerhorn, (Wed Oct 22, 8:28 am)
Re: [RFC][PATCH] lru_add_drain_all() don't use schedule_on ..., Christoph Lameter, (Tue Oct 28, 7:25 am)
Re: [RFC][PATCH] lru_add_drain_all() don't use schedule_on ..., KAMEZAWA Hiroyuki, (Wed Oct 29, 1:21 am)
[PATCH] get rid of lru_add_drain_all() in munlock path, KOSAKI Motohiro, (Wed Nov 5, 5:14 pm)
Re: [PATCH] get rid of lru_add_drain_all() in munlock path, Kamalesh Babulal, (Thu Nov 6, 9:33 am)