]> git.karo-electronics.de Git - karo-tx-linux.git/commit
hugetlb: detect race upon page allocation failure during COW
authorHillf Danton <dhillf@gmail.com>
Thu, 8 Dec 2011 04:41:43 +0000 (15:41 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 Dec 2011 05:48:04 +0000 (16:48 +1100)
commit8192bd1286a955414d4d92321ec5ac9c8374e38f
treed2f9163e1b34591a22b5301c1f594e504d292c55
parent6c52d836736c55877be08ce2a5e91e181fb54154
hugetlb: detect race upon page allocation failure during COW

Currently we are not rechecking pte_same in hugetlb_cow after we take ptl
lock again in the page allocation failure code path and simply retry
again.  This is not an issue at the moment because hugetlb fault path is
protected by hugetlb_instantiation_mutex so we cannot race.

The original page is locked and so we cannot race even with the page
migration.

Let's add the pte_same check anyway as we want to be consistent with the
other check later in this function and be safe if we ever remove the
mutex.

[mhocko@suse.cz: reworded the changelog]
Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <jweiner@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c