Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e541973 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds
Browse files

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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: default avatarKamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9f8f2172
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -150,7 +150,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
	secondary_data.pgdir = 0;
	secondary_data.pgdir = 0;


	*pmd_offset(pgd, PHYS_OFFSET) = __pmd(0);
	*pmd_offset(pgd, PHYS_OFFSET) = __pmd(0);
	pgd_free(pgd);
	pgd_free(&init_mm, pgd);


	if (ret) {
	if (ret) {
		printk(KERN_CRIT "CPU%u: processor failed to boot\n", cpu);
		printk(KERN_CRIT "CPU%u: processor failed to boot\n", cpu);
+1 −1
Original line number Original line Diff line number Diff line
@@ -162,7 +162,7 @@ static void unmap_area_sections(unsigned long virt, unsigned long size)
			 * Free the page table, if there was one.
			 * Free the page table, if there was one.
			 */
			 */
			if ((pmd_val(pmd) & PMD_TYPE_MASK) == PMD_TYPE_TABLE)
			if ((pmd_val(pmd) & PMD_TYPE_MASK) == PMD_TYPE_TABLE)
				pte_free_kernel(pmd_page_vaddr(pmd));
				pte_free_kernel(&init_mm, pmd_page_vaddr(pmd));
		}
		}


		addr += PGDIR_SIZE;
		addr += PGDIR_SIZE;
+4 −4
Original line number Original line Diff line number Diff line
@@ -65,14 +65,14 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
	return new_pgd;
	return new_pgd;


no_pte:
no_pte:
	pmd_free(new_pmd);
	pmd_free(mm, new_pmd);
no_pmd:
no_pmd:
	free_pages((unsigned long)new_pgd, 2);
	free_pages((unsigned long)new_pgd, 2);
no_pgd:
no_pgd:
	return NULL;
	return NULL;
}
}


void free_pgd_slow(pgd_t *pgd)
void free_pgd_slow(struct mm_struct *mm, pgd_t *pgd)
{
{
	pmd_t *pmd;
	pmd_t *pmd;
	struct page *pte;
	struct page *pte;
@@ -94,8 +94,8 @@ void free_pgd_slow(pgd_t *pgd)
	pmd_clear(pmd);
	pmd_clear(pmd);
	dec_zone_page_state(virt_to_page((unsigned long *)pgd), NR_PAGETABLE);
	dec_zone_page_state(virt_to_page((unsigned long *)pgd), NR_PAGETABLE);
	pte_lock_deinit(pte);
	pte_lock_deinit(pte);
	pte_free(pte);
	pte_free(mm, pte);
	pmd_free(pmd);
	pmd_free(mm, pmd);
free:
free:
	free_pages((unsigned long) pgd, 2);
	free_pages((unsigned long) pgd, 2);
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -140,7 +140,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
	return pgd;
	return pgd;
}
}


void pgd_free(pgd_t *pgd)
void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
{
	/* in the non-PAE case, clear_page_tables() clears user pgd entries */
	/* in the non-PAE case, clear_page_tables() clears user pgd entries */
 	quicklist_free(0, pgd_dtor, pgd);
 	quicklist_free(0, pgd_dtor, pgd);
+3 −3
Original line number Original line Diff line number Diff line
@@ -86,7 +86,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
	return ret;
	return ret;
}
}


void pgd_free(pgd_t *pgd)
void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
{
	free_pages((unsigned long)pgd, PGDIR_ORDER);
	free_pages((unsigned long)pgd, PGDIR_ORDER);
}
}
@@ -123,7 +123,7 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
	return ptepage;
	return ptepage;
}
}


void pte_free_kernel(pte_t *pte)
void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
	hash_page_sync();
	hash_page_sync();
@@ -131,7 +131,7 @@ void pte_free_kernel(pte_t *pte)
	free_page((unsigned long)pte);
	free_page((unsigned long)pte);
}
}


void pte_free(struct page *ptepage)
void pte_free(struct mm_struct *mm, struct page *ptepage)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
	hash_page_sync();
	hash_page_sync();
Loading