[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00000142c99cf5b0-69cc9987-aa36-4889-af6a-1a45032d0d13-000000@email.amazonses.com>
Date: Fri, 6 Dec 2013 20:32:56 +0000
From: Christoph Lameter <cl@...ux.com>
To: Rik van Riel <riel@...hat.com>
cc: Mel Gorman <mgorman@...e.de>, Alex Thorlton <athorlton@....com>,
Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 14/15] mm: fix TLB flush race between migration, and
change_protection_range
On Fri, 6 Dec 2013, Rik van Riel wrote:
>
> The basic race looks like this:
>
> CPU A CPU B CPU C
>
> load TLB entry
> make entry PTE/PMD_NUMA
> fault on entry
> read/write old page
> start migrating page
When you start migrating a page a special page migration entry is
created that will trap all accesses to the page. You can safely flush when
the migration entry is there. Only allow a new PTE/PMD to be put there
*after* the tlb flush.
> change PTE/PMD to new page
Dont do that. We have migration entries for a reason.
> read/write old page [*]
Should cause a page fault which should put the process to sleep. Process
will safely read the page after the migration entry is removed.
> flush TLB
Establish the new PTE/PMD after the flush removing the migration pte
entry and thereby avoiding the race.
> reload TLB from new entry
> read/write new page
> lose data
>
> [*] the old page may belong to a new user at this point!
>
--
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