aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorRobin Getz <robin.getz@analog.com>2007-11-15 07:57:53 -0500
committerBryan Wu <bryan.wu@analog.com>2007-11-15 07:57:53 -0500
commit839e01c2bfba34f97ec36d0d355801e94254ffd5 (patch)
tree286efca13b5b9e4dc195460f34409d703b7725c3 /arch/blackfin
parent74ce8322bf8843e6fd04e081d361c107bcf73564 (diff)
Blackfin arch: move the init sections to the end of memory to help decrease memory fragementation
move the init sections to the end of memory, so that after they are free, run time memory is all continugous - this should help decrease memory fragementation. When doing this, we also pack some of the other sections a little closer together, to make sure we don't waste memory. To make this happen, we need to rename the .data.init_task section to .init_task.data, so it doesn't get picked up by the linker script glob. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/kernel/init_task.c2
-rw-r--r--arch/blackfin/kernel/setup.c8
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S47
3 files changed, 33 insertions, 24 deletions
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
index 673c860ffc23..c640154030e2 100644
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -57,5 +57,5 @@ EXPORT_SYMBOL(init_task);
57 * "init_task" linker map entry. 57 * "init_task" linker map entry.
58 */ 58 */
59union thread_union init_thread_union 59union thread_union init_thread_union
60 __attribute__ ((__section__(".data.init_task"))) = { 60 __attribute__ ((__section__(".init_task.data"))) = {
61INIT_THREAD_INFO(init_task)}; 61INIT_THREAD_INFO(init_task)};
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 934234f43839..dfe06b09a9d4 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -236,7 +236,7 @@ void __init setup_arch(char **cmdline_p)
236 /* by now the stack is part of the init task */ 236 /* by now the stack is part of the init task */
237 memory_end = _ramend - DMA_UNCACHED_REGION; 237 memory_end = _ramend - DMA_UNCACHED_REGION;
238 238
239 _ramstart = (unsigned long)__bss_stop; 239 _ramstart = (unsigned long)_end;
240 memory_start = PAGE_ALIGN(_ramstart); 240 memory_start = PAGE_ALIGN(_ramstart);
241 241
242#if defined(CONFIG_MTD_UCLINUX) 242#if defined(CONFIG_MTD_UCLINUX)
@@ -285,7 +285,7 @@ void __init setup_arch(char **cmdline_p)
285 } 285 }
286 286
287 /* Relocate MTD image to the top of memory after the uncached memory area */ 287 /* Relocate MTD image to the top of memory after the uncached memory area */
288 dma_memcpy((char *)memory_end, __bss_stop, mtd_size); 288 dma_memcpy((char *)memory_end, _end, mtd_size);
289 289
290 memory_mtd_start = memory_end; 290 memory_mtd_start = memory_end;
291 _ebss = memory_mtd_start; /* define _ebss for compatible */ 291 _ebss = memory_mtd_start; /* define _ebss for compatible */
@@ -357,10 +357,10 @@ void __init setup_arch(char **cmdline_p)
357 printk(KERN_INFO "Memory map:\n" 357 printk(KERN_INFO "Memory map:\n"
358 KERN_INFO " text = 0x%p-0x%p\n" 358 KERN_INFO " text = 0x%p-0x%p\n"
359 KERN_INFO " rodata = 0x%p-0x%p\n" 359 KERN_INFO " rodata = 0x%p-0x%p\n"
360 KERN_INFO " bss = 0x%p-0x%p\n"
360 KERN_INFO " data = 0x%p-0x%p\n" 361 KERN_INFO " data = 0x%p-0x%p\n"
361 KERN_INFO " stack = 0x%p-0x%p\n" 362 KERN_INFO " stack = 0x%p-0x%p\n"
362 KERN_INFO " init = 0x%p-0x%p\n" 363 KERN_INFO " init = 0x%p-0x%p\n"
363 KERN_INFO " bss = 0x%p-0x%p\n"
364 KERN_INFO " available = 0x%p-0x%p\n" 364 KERN_INFO " available = 0x%p-0x%p\n"
365#ifdef CONFIG_MTD_UCLINUX 365#ifdef CONFIG_MTD_UCLINUX
366 KERN_INFO " rootfs = 0x%p-0x%p\n" 366 KERN_INFO " rootfs = 0x%p-0x%p\n"
@@ -370,10 +370,10 @@ void __init setup_arch(char **cmdline_p)
370#endif 370#endif
371 , _stext, _etext, 371 , _stext, _etext,
372 __start_rodata, __end_rodata, 372 __start_rodata, __end_rodata,
373 __bss_start, __bss_stop,
373 _sdata, _edata, 374 _sdata, _edata,
374 (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000), 375 (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000),
375 __init_begin, __init_end, 376 __init_begin, __init_end,
376 __bss_start, __bss_stop,
377 (void *)_ramstart, (void *)memory_end 377 (void *)_ramstart, (void *)memory_end
378#ifdef CONFIG_MTD_UCLINUX 378#ifdef CONFIG_MTD_UCLINUX
379 , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size) 379 , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 9b75bc83c71f..5bdc0f79bb1a 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -41,6 +41,9 @@ _jiffies = _jiffies_64;
41SECTIONS 41SECTIONS
42{ 42{
43 . = CONFIG_BOOT_LOAD; 43 . = CONFIG_BOOT_LOAD;
44 /* Neither the text, ro_data or bss section need to be aligned
45 * So pack them back to back
46 */
44 .text : 47 .text :
45 { 48 {
46 __text = .; 49 __text = .;
@@ -58,22 +61,25 @@ SECTIONS
58 *(__ex_table) 61 *(__ex_table)
59 ___stop___ex_table = .; 62 ___stop___ex_table = .;
60 63
61 . = ALIGN(4);
62 __etext = .; 64 __etext = .;
63 } 65 }
64 66
65 RO_DATA(PAGE_SIZE) 67 /* Just in case the first read only is a 32-bit access */
68 RO_DATA(4)
69
70 .bss :
71 {
72 . = ALIGN(4);
73 ___bss_start = .;
74 *(.bss .bss.*)
75 *(COMMON)
76 ___bss_stop = .;
77 }
66 78
67 .data : 79 .data :
68 { 80 {
69 /* make sure the init_task is aligned to the
70 * kernel thread size so we can locate the kernel
71 * stack properly and quickly.
72 */
73 __sdata = .; 81 __sdata = .;
74 . = ALIGN(THREAD_SIZE); 82 /* This gets done first, so the glob doesn't suck it in */
75 *(.data.init_task)
76
77 . = ALIGN(32); 83 . = ALIGN(32);
78 *(.data.cacheline_aligned) 84 *(.data.cacheline_aligned)
79 85
@@ -81,10 +87,22 @@ SECTIONS
81 *(.data.*) 87 *(.data.*)
82 CONSTRUCTORS 88 CONSTRUCTORS
83 89
90 /* make sure the init_task is aligned to the
91 * kernel thread size so we can locate the kernel
92 * stack properly and quickly.
93 */
84 . = ALIGN(THREAD_SIZE); 94 . = ALIGN(THREAD_SIZE);
95 *(.init_task.data)
96
85 __edata = .; 97 __edata = .;
86 } 98 }
87 99
100 /* The init section should be last, so when we free it, it goes into
101 * the general memory pool, and (hopefully) will decrease fragmentation
102 * a tiny bit. The init section has a _requirement_ that it be
103 * PAGE_SIZE aligned
104 */
105 . = ALIGN(PAGE_SIZE);
88 ___init_begin = .; 106 ___init_begin = .;
89 107
90 .init.text : 108 .init.text :
@@ -179,16 +197,7 @@ SECTIONS
179 . = ALIGN(PAGE_SIZE); 197 . = ALIGN(PAGE_SIZE);
180 ___init_end = .; 198 ___init_end = .;
181 199
182 .bss : 200 __end =.;
183 {
184 . = ALIGN(4);
185 ___bss_start = .;
186 *(.bss .bss.*)
187 *(COMMON)
188 . = ALIGN(4);
189 ___bss_stop = .;
190 __end = .;
191 }
192 201
193 STABS_DEBUG 202 STABS_DEBUG
194 203