add mm argument to pte/pmd/pud/pgd_free
(with Martin Schwidefsky <schwidefsky@de.ibm.com>) The pgd/pud/pmd/pte page table allocation functions get a mm_struct pointer as first argument. The free functions do not get the mm_struct argument. This is 1) asymmetrical and 2) to do mm related page table allocations the mm argument is needed on the free function as well. [kamalesh@linux.vnet.ibm.com: i386 fix] [akpm@linux-foundation.org: coding-syle fixes] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
9f8f217253
commit
5e5419734c
10
mm/memory.c
10
mm/memory.c
@@ -305,7 +305,7 @@ int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address)
|
||||
spin_lock(&mm->page_table_lock);
|
||||
if (pmd_present(*pmd)) { /* Another has populated it */
|
||||
pte_lock_deinit(new);
|
||||
pte_free(new);
|
||||
pte_free(mm, new);
|
||||
} else {
|
||||
mm->nr_ptes++;
|
||||
inc_zone_page_state(new, NR_PAGETABLE);
|
||||
@@ -323,7 +323,7 @@ int __pte_alloc_kernel(pmd_t *pmd, unsigned long address)
|
||||
|
||||
spin_lock(&init_mm.page_table_lock);
|
||||
if (pmd_present(*pmd)) /* Another has populated it */
|
||||
pte_free_kernel(new);
|
||||
pte_free_kernel(&init_mm, new);
|
||||
else
|
||||
pmd_populate_kernel(&init_mm, pmd, new);
|
||||
spin_unlock(&init_mm.page_table_lock);
|
||||
@@ -2501,7 +2501,7 @@ int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
|
||||
|
||||
spin_lock(&mm->page_table_lock);
|
||||
if (pgd_present(*pgd)) /* Another has populated it */
|
||||
pud_free(new);
|
||||
pud_free(mm, new);
|
||||
else
|
||||
pgd_populate(mm, pgd, new);
|
||||
spin_unlock(&mm->page_table_lock);
|
||||
@@ -2523,12 +2523,12 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
|
||||
spin_lock(&mm->page_table_lock);
|
||||
#ifndef __ARCH_HAS_4LEVEL_HACK
|
||||
if (pud_present(*pud)) /* Another has populated it */
|
||||
pmd_free(new);
|
||||
pmd_free(mm, new);
|
||||
else
|
||||
pud_populate(mm, pud, new);
|
||||
#else
|
||||
if (pgd_present(*pud)) /* Another has populated it */
|
||||
pmd_free(new);
|
||||
pmd_free(mm, new);
|
||||
else
|
||||
pgd_populate(mm, pud, new);
|
||||
#endif /* __ARCH_HAS_4LEVEL_HACK */
|
||||
|
Reference in New Issue
Block a user