diff options
Diffstat (limited to 'recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch')
-rw-r--r-- | recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch b/recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch new file mode 100644 index 00000000..c32f8809 --- /dev/null +++ b/recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | From: Michal Simek <michal.simek@xilinx.com> | ||
2 | Subject: [LINUX PATCH 2/3] microblaze: Fix free_init_pages function | ||
3 | |||
4 | - fce() is used only in init.c file - let's use static | ||
5 | - start and end addresses should be page align | ||
6 | - remove additional addr variable | ||
7 | - use pr_info instead of printk(KERN_INFO...) | ||
8 | - use __free_page(page) instead of free_page(start) | ||
9 | it is faster because of no checking, | ||
10 | if ramdisk is out of the kernel you will get kernel panic anyway | ||
11 | |||
12 | Signed-off-by: Michal Simek <michal.simek@xilinx.com> | ||
13 | --- | ||
14 | arch/microblaze/include/asm/setup.h | 1 - | ||
15 | arch/microblaze/mm/init.c | 20 +++++++++++++------- | ||
16 | 2 files changed, 13 insertions(+), 8 deletions(-) | ||
17 | |||
18 | diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h | ||
19 | index 0e0b0a5..f05df56 100644 | ||
20 | --- a/arch/microblaze/include/asm/setup.h | ||
21 | +++ b/arch/microblaze/include/asm/setup.h | ||
22 | @@ -46,7 +46,6 @@ void machine_shutdown(void); | ||
23 | void machine_halt(void); | ||
24 | void machine_power_off(void); | ||
25 | |||
26 | -void free_init_pages(char *what, unsigned long begin, unsigned long end); | ||
27 | extern void *alloc_maybe_bootmem(size_t size, gfp_t mask); | ||
28 | extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); | ||
29 | |||
30 | diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c | ||
31 | index ce80823..09affec 100644 | ||
32 | --- a/arch/microblaze/mm/init.c | ||
33 | +++ b/arch/microblaze/mm/init.c | ||
34 | @@ -236,17 +236,23 @@ void __init setup_memory(void) | ||
35 | paging_init(); | ||
36 | } | ||
37 | |||
38 | -void free_init_pages(char *what, unsigned long begin, unsigned long end) | ||
39 | +static void free_init_pages(char *what, unsigned long start, unsigned long end) | ||
40 | { | ||
41 | - unsigned long addr; | ||
42 | + if (start >= end) | ||
43 | + return; | ||
44 | |||
45 | - for (addr = begin; addr < end; addr += PAGE_SIZE) { | ||
46 | - ClearPageReserved(virt_to_page(addr)); | ||
47 | - init_page_count(virt_to_page(addr)); | ||
48 | - free_page(addr); | ||
49 | + start = PAGE_DOWN(start); | ||
50 | + end = PAGE_UP(end); | ||
51 | + | ||
52 | + pr_info("Freeing %s: %ldk freed\n", what, (end - start) >> 10); | ||
53 | + | ||
54 | + for (; start < end; start += PAGE_SIZE) { | ||
55 | + struct page *page = virt_to_page(start); | ||
56 | + ClearPageReserved(page); | ||
57 | + init_page_count(page); | ||
58 | + __free_page(page); | ||
59 | totalram_pages++; | ||
60 | } | ||
61 | - printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); | ||
62 | } | ||
63 | |||
64 | #ifdef CONFIG_BLK_DEV_INITRD | ||
65 | -- | ||
66 | 1.8.2.1 | ||
67 | |||
68 | |||