mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
sparc32: add init memory poisoning
This patch adds init memory poisoning. It looks like totalram_pages was not updated properly in free_initrd_mem so I fixed that as well. Signed-off-by: Robert Reif <reif@earthlink.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
94d5b5432b
commit
1aa0365f27
1 changed files with 11 additions and 3 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/bootmem.h>
|
#include <linux/bootmem.h>
|
||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
|
#include <linux/poison.h>
|
||||||
|
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
#include <asm/vac-ops.h>
|
#include <asm/vac-ops.h>
|
||||||
|
@ -480,6 +481,7 @@ void free_initmem (void)
|
||||||
for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
|
for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
|
||||||
struct page *p;
|
struct page *p;
|
||||||
|
|
||||||
|
memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
|
||||||
p = virt_to_page(addr);
|
p = virt_to_page(addr);
|
||||||
|
|
||||||
ClearPageReserved(p);
|
ClearPageReserved(p);
|
||||||
|
@ -488,20 +490,26 @@ void free_initmem (void)
|
||||||
totalram_pages++;
|
totalram_pages++;
|
||||||
num_physpages++;
|
num_physpages++;
|
||||||
}
|
}
|
||||||
printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10);
|
printk(KERN_INFO "Freeing unused kernel memory: %dk freed\n",
|
||||||
|
(&__init_end - &__init_begin) >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_DEV_INITRD
|
#ifdef CONFIG_BLK_DEV_INITRD
|
||||||
void free_initrd_mem(unsigned long start, unsigned long end)
|
void free_initrd_mem(unsigned long start, unsigned long end)
|
||||||
{
|
{
|
||||||
if (start < end)
|
if (start < end)
|
||||||
printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
|
printk(KERN_INFO "Freeing initrd memory: %ldk freed\n",
|
||||||
|
(end - start) >> 10);
|
||||||
for (; start < end; start += PAGE_SIZE) {
|
for (; start < end; start += PAGE_SIZE) {
|
||||||
struct page *p = virt_to_page(start);
|
struct page *p;
|
||||||
|
|
||||||
|
memset((void *)start, POISON_FREE_INITMEM, PAGE_SIZE);
|
||||||
|
p = virt_to_page(start);
|
||||||
|
|
||||||
ClearPageReserved(p);
|
ClearPageReserved(p);
|
||||||
init_page_count(p);
|
init_page_count(p);
|
||||||
__free_page(p);
|
__free_page(p);
|
||||||
|
totalram_pages++;
|
||||||
num_physpages++;
|
num_physpages++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue