Commit b339158a authored by David S. Miller's avatar David S. Miller

[MM]: PTRS_PER_{PUD,PMD} are not necessarily compile time constants.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2e5cbd2d
......@@ -2089,7 +2089,6 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct * vma,
}
#ifndef __ARCH_HAS_4LEVEL_HACK
#if (PTRS_PER_PUD > 1)
/*
* Allocate page upper directory.
*
......@@ -2101,29 +2100,30 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct * vma,
*/
pud_t fastcall *__pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
{
pud_t *new;
if (PTRS_PER_PUD > 1) {
pud_t *new;
spin_unlock(&mm->page_table_lock);
new = pud_alloc_one(mm, address);
spin_lock(&mm->page_table_lock);
if (!new)
return NULL;
spin_unlock(&mm->page_table_lock);
new = pud_alloc_one(mm, address);
spin_lock(&mm->page_table_lock);
if (!new)
return NULL;
/*
* Because we dropped the lock, we should re-check the
* entry, as somebody else could have populated it..
*/
if (pgd_present(*pgd)) {
pud_free(new);
goto out;
/*
* Because we dropped the lock, we should re-check the
* entry, as somebody else could have populated it..
*/
if (pgd_present(*pgd)) {
pud_free(new);
goto out;
}
pgd_populate(mm, pgd, new);
out:
return pud_offset(pgd, address);
}
pgd_populate(mm, pgd, new);
out:
return pud_offset(pgd, address);
return NULL;
}
#endif
#if (PTRS_PER_PMD > 1)
/*
* Allocate page middle directory.
*
......@@ -2135,27 +2135,29 @@ pud_t fastcall *__pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long addr
*/
pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
{
pmd_t *new;
if (PTRS_PER_PMD > 1) {
pmd_t *new;
spin_unlock(&mm->page_table_lock);
new = pmd_alloc_one(mm, address);
spin_lock(&mm->page_table_lock);
if (!new)
return NULL;
spin_unlock(&mm->page_table_lock);
new = pmd_alloc_one(mm, address);
spin_lock(&mm->page_table_lock);
if (!new)
return NULL;
/*
* Because we dropped the lock, we should re-check the
* entry, as somebody else could have populated it..
*/
if (pud_present(*pud)) {
pmd_free(new);
goto out;
/*
* Because we dropped the lock, we should re-check the
* entry, as somebody else could have populated it..
*/
if (pud_present(*pud)) {
pmd_free(new);
goto out;
}
pud_populate(mm, pud, new);
out:
return pmd_offset(pud, address);
}
pud_populate(mm, pud, new);
out:
return pmd_offset(pud, address);
return NULL;
}
#endif
#else
pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment