[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=iYQCmKsE_xR4x0h-6BiVkpD3R2y6pKa1b9K0+@mail.gmail.com>
Date: Tue, 8 Feb 2011 10:28:12 -0800
From: Hugh Dickins <hughd@...gle.com>
To: Michel Lespinasse <walken@...gle.com>
Cc: linux-mm@...ck.org, Lee Schermerhorn <lee.schermerhorn@...com>,
Andrew Morton <akpm@...ux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Rik van Riel <riel@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mlock: fix race when munlocking pages in do_wp_page()
On Mon, Feb 7, 2011 at 4:47 PM, Michel Lespinasse <walken@...gle.com> wrote:
>
> vmscan can lazily find pages that are mapped within VM_LOCKED vmas,
> and set the PageMlocked bit on these pages, transfering them onto the
> unevictable list. When do_wp_page() breaks COW within a VM_LOCKED vma,
> it may need to clear PageMlocked on the old page and set it on the
> new page instead.
>
> This change fixes an issue where do_wp_page() was clearing PageMlocked on
> the old page while the pte was still pointing to it (as well as rmap).
> Therefore, we were not protected against vmscan immediately trasnfering
> the old page back onto the unevictable list. This could cause pages to
> get stranded there forever.
>
> I propose to move the corresponding code to the end of do_wp_page(),
> after the pte (and rmap) have been pointed to the new page. Additionally,
> we can use munlock_vma_page() instead of clear_page_mlock(), so that
> the old page stays mlocked if there are still other VM_LOCKED vmas
> mapping it.
>
> Signed-off-by: Michel Lespinasse <walken@...gle.com>
Acked-by: Hugh Dickins <hughd@...gle.com>
(but I have to say, do_wp_page() grows even ughlier!)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists