hugetlb: move refcounting in hugepage allocation inside hugetlb_lock
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Wed, 8 Sep 2010 01:19:37 +0000 (10:19 +0900)
committerAndi Kleen <ak@linux.intel.com>
Fri, 8 Oct 2010 07:32:45 +0000 (09:32 +0200)
commita9869b837c098732bad84939015c0eb391b23e41
tree00ba63997470724e2704c9b7c995c91672b53c7b
parent6de2b1aab94355482bd2accdc115666509667458
hugetlb: move refcounting in hugepage allocation inside hugetlb_lock

Currently alloc_huge_page() raises page refcount outside hugetlb_lock.
but it causes race when dequeue_hwpoison_huge_page() runs concurrently
with alloc_huge_page().
To avoid it, this patch moves set_page_refcounted() in hugetlb_lock.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
mm/hugetlb.c