[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150513080823.GH17628@esperanza>
Date: Wed, 13 May 2015 11:08:23 +0300
From: Vladimir Davydov <vdavydov@...allels.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Rik van Riel <riel@...hat.com>,
Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH v2] rmap: fix theoretical race between do_wp_page and
shrink_active_list
On Tue, May 12, 2015 at 03:28:40PM -0700, Andrew Morton wrote:
> Please let's not put things like WRITE_ONCE() in there without
> documenting them - otherwise it's terribly hard for readers to work out
> why it was added.
>
> How's this look?
>
> --- a/mm/rmap.c~rmap-fix-theoretical-race-between-do_wp_page-and-shrink_active_list-fix
> +++ a/mm/rmap.c
> @@ -950,6 +950,11 @@ void page_move_anon_rmap(struct page *pa
> VM_BUG_ON_PAGE(page->index != linear_page_index(vma, address), page);
>
> anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
> + /*
> + * Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written
> + * simultaneously, so a concurrent reader (eg shrink_active_list) will
> + * not see one without the other.
> + */
> WRITE_ONCE(page->mapping, (struct address_space *) anon_vma);
> }
Looks good to me.
Thanks,
Vladimir
--
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