Index: linux-2.6.19-rc6-mm2/mm/hugetlb.c =================================================================== --- linux-2.6.19-rc6-mm2.orig/mm/hugetlb.c 2006-12-06 18:03:12.000000000 -0600 +++ linux-2.6.19-rc6-mm2/mm/hugetlb.c 2006-12-06 18:06:06.130078150 -0600 @@ -484,6 +484,16 @@ retry: goto out; if (hugetlb_get_quota(mapping)) goto out; + + err = add_to_page_cache(zero_page, mapping, idx, GFP_KERNEL); + if (err) { + put_page(page); + hugetlb_put_quota(mapping); + if (err = -EEXIST) + goto retry; + goto out; + } + page = alloc_huge_page(vma, address); if (!page) { hugetlb_put_quota(mapping); @@ -544,22 +554,14 @@ int hugetlb_fault(struct mm_struct *mm, pte_t *ptep; pte_t entry; int ret; - static DEFINE_MUTEX(hugetlb_instantiation_mutex); ptep = huge_pte_alloc(mm, address); if (!ptep) return VM_FAULT_OOM; - /* - * Serialize hugepage allocation and instantiation, so that we don't - * get spurious allocation failures if two CPUs race to instantiate - * the same page in the page cache. - */ - mutex_lock(&hugetlb_instantiation_mutex); entry = *ptep; if (pte_none(entry)) { ret = hugetlb_no_page(mm, vma, address, ptep, write_access); - mutex_unlock(&hugetlb_instantiation_mutex); return ret; } @@ -571,7 +573,6 @@ int hugetlb_fault(struct mm_struct *mm, if (write_access && !pte_write(entry)) ret = hugetlb_cow(mm, vma, address, ptep, entry); spin_unlock(&mm->page_table_lock); - mutex_unlock(&hugetlb_instantiation_mutex); return ret; }