Commit a97de48b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc44x: fix memory leak

From: Matt Porter <mporter@kernel.crashing.org>

This fixes a memory leak when freeing pgds on PPC44x.
parent 425c9687
...@@ -738,12 +738,15 @@ _GLOBAL(__flush_dcache_icache_phys) ...@@ -738,12 +738,15 @@ _GLOBAL(__flush_dcache_icache_phys)
blr blr
/* /*
* Clear a page using the dcbz instruction, which doesn't cause any * Clear pages using the dcbz instruction, which doesn't cause any
* memory traffic (except to write out any cache lines which get * memory traffic (except to write out any cache lines which get
* displaced). This only works on cacheable memory. * displaced). This only works on cacheable memory.
*
* void clear_pages(void *page, int order) ;
*/ */
_GLOBAL(clear_page) _GLOBAL(clear_pages)
li r0,4096/L1_CACHE_LINE_SIZE li r0,4096/L1_CACHE_LINE_SIZE
slw r0,r0,r4
mtctr r0 mtctr r0
#ifdef CONFIG_8xx #ifdef CONFIG_8xx
li r4, 0 li r4, 0
......
...@@ -71,13 +71,13 @@ pgd_t *pgd_alloc(struct mm_struct *mm) ...@@ -71,13 +71,13 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
pgd_t *ret; pgd_t *ret;
if ((ret = (pgd_t *)__get_free_pages(GFP_KERNEL, PGDIR_ORDER)) != NULL) if ((ret = (pgd_t *)__get_free_pages(GFP_KERNEL, PGDIR_ORDER)) != NULL)
clear_page(ret); clear_pages(ret, PGDIR_ORDER);
return ret; return ret;
} }
void pgd_free(pgd_t *pgd) void pgd_free(pgd_t *pgd)
{ {
free_page((unsigned long)pgd); free_pages((unsigned long)pgd, PGDIR_ORDER);
} }
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
......
...@@ -84,7 +84,8 @@ typedef unsigned long pgprot_t; ...@@ -84,7 +84,8 @@ typedef unsigned long pgprot_t;
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
struct page; struct page;
extern void clear_page(void *page); extern void clear_pages(void *page, int order);
static inline void clear_page(void *page) { clear_pages(page, 0); }
extern void copy_page(void *to, void *from); extern void copy_page(void *to, void *from);
extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
extern void copy_user_page(void *to, void *from, unsigned long vaddr, extern void copy_user_page(void *to, void *from, unsigned long vaddr,
......
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