On 08/02/2012 10:16 AM, Michal Hocko wrote:
Hi Andrew,
the following patch fixes yet-another race in the hugetlb pte sharing
code reported by Larry. It is based on top of the current -mm tree but
it cleanly applies to linus tree as well. It should go to stable as
well. The bug is there for ages but this fix is possible only since 3.0
because i_mmap_lock used to be a spinlock until 3d48ae45 which turned it
into mutex and so we can call pmd_alloc.

This patch addresses the issue by moving pmd_alloc into huge_pmd_share
which guarantees that the shared pud is populated in the same
critical section as pmd. This also means that huge_pte_offset test in
huge_pmd_share is serialized correctly now which in turn means that
the success of the sharing will be higher as the racing tasks see the
pud and pmd populated together.

Race identified and changelog written mostly by Mel Gorman
Reported-and-tested-by: Larry Woodman <lwood...@redhat.com>
Reviewed-by: Mel Gorman <mgor...@suse.de>
Signed-off-by: Michal Hocko <mho...@suse.cz>

Reviewed-by: Rik van Riel <r...@redhat.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to