Re: [PATCH 02/13] mm: Revalidate anon_vma in page_lock_anon_vma()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: KAMEZAWA Hiroyuki
Date: Thursday, April 8, 2010 - 9:56 pm

On Fri, 9 Apr 2010 13:16:41 +1000
Nick Piggin <npiggin@suse.de> wrote:

IIUC.

Before Rik's change to anon_vma, once page->mapping is set as anon_vma | 0x1,
it's not modified until the page is freed.
After the patch, do_wp_page() overwrite page->mapping when it reuse existing
page.

==
static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
                unsigned long address, pte_t *page_table, pmd_t *pmd,
                spinlock_t *ptl, pte_t orig_pte)
{
....
        if (PageAnon(old_page) && !PageKsm(old_page)) {
                if (!trylock_page(old_page)) {
                        page_cache_get(old_page);
....
                reuse = reuse_swap_page(old_page);
                if (reuse)
                        /*
                         * The page is all ours.  Move it to our anon_vma so
                         * the rmap code will not search our parent or siblings.
                         * Protected against the rmap code by the page lock.
                         */
                        page_move_anon_rmap(old_page, vma, address); ----(*)
}
===		
(*) is new.

Then, this new check makes sense in the current kernel.



I think so.

Thanks,
-Kame

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

Messages in current thread:
Re: [PATCH 02/13] mm: Revalidate anon_vma in page_lock_ano ..., KAMEZAWA Hiroyuki, (Thu Apr 8, 9:56 pm)
Re: [PATCH 02/13] mm: Revalidate anon_vma in page_lock_ano ..., KAMEZAWA Hiroyuki, (Thu Apr 8, 11:47 pm)
Re: [PATCH 02/13] mm: Revalidate anon_vma in page_lock_ano ..., KAMEZAWA Hiroyuki, (Fri Apr 9, 12:57 am)
mlock and pageout race?, Minchan Kim, (Fri Apr 9, 7:41 am)