diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-02-02 02:53:17 -0500 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2008-02-02 02:53:17 -0500 |
commit | b7627acc432a36072253bb1288f56e78c7d9423e (patch) | |
tree | 1d79f1c3a68c21ec1b51428a88d8f5149dbbbbf4 | |
parent | 80f31c8a03d2f0644d0ceaf14e7e0108a007c962 (diff) |
[Blackfin] arch: move the init sections to the end of memory
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: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
-rw-r--r-- | arch/blackfin/kernel/init_task.c | 2 | ||||
-rw-r--r-- | arch/blackfin/kernel/setup.c | 14 | ||||
-rw-r--r-- | arch/blackfin/kernel/vmlinux.lds.S | 47 |
3 files changed, 36 insertions, 27 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 | */ |
59 | union thread_union init_thread_union | 59 | union thread_union init_thread_union |
60 | __attribute__ ((__section__(".data.init_task"))) = { | 60 | __attribute__ ((__section__(".init_task.data"))) = { |
61 | INIT_THREAD_INFO(init_task)}; | 61 | INIT_THREAD_INFO(init_task)}; |
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index aca5e6e5bbdd..060080789495 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -427,7 +427,7 @@ static __init void parse_cmdline_early(char *cmdline_p) | |||
427 | static __init void memory_setup(void) | 427 | static __init void memory_setup(void) |
428 | { | 428 | { |
429 | _rambase = (unsigned long)_stext; | 429 | _rambase = (unsigned long)_stext; |
430 | _ramstart = (unsigned long)__bss_stop; | 430 | _ramstart = (unsigned long)_end; |
431 | 431 | ||
432 | if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { | 432 | if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { |
433 | console_init(); | 433 | console_init(); |
@@ -489,7 +489,7 @@ static __init void memory_setup(void) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | /* Relocate MTD image to the top of memory after the uncached memory area */ | 491 | /* Relocate MTD image to the top of memory after the uncached memory area */ |
492 | dma_memcpy((char *)memory_end, __bss_stop, mtd_size); | 492 | dma_memcpy((char *)memory_end, _end, mtd_size); |
493 | 493 | ||
494 | memory_mtd_start = memory_end; | 494 | memory_mtd_start = memory_end; |
495 | _ebss = memory_mtd_start; /* define _ebss for compatible */ | 495 | _ebss = memory_mtd_start; /* define _ebss for compatible */ |
@@ -528,13 +528,13 @@ static __init void memory_setup(void) | |||
528 | printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20); | 528 | printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20); |
529 | printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); | 529 | printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); |
530 | 530 | ||
531 | printk( KERN_INFO "Memory map:\n" | 531 | printk(KERN_INFO "Memory map:\n" |
532 | KERN_INFO " text = 0x%p-0x%p\n" | 532 | KERN_INFO " text = 0x%p-0x%p\n" |
533 | KERN_INFO " rodata = 0x%p-0x%p\n" | 533 | KERN_INFO " rodata = 0x%p-0x%p\n" |
534 | KERN_INFO " bss = 0x%p-0x%p\n" | ||
534 | KERN_INFO " data = 0x%p-0x%p\n" | 535 | KERN_INFO " data = 0x%p-0x%p\n" |
535 | KERN_INFO " stack = 0x%p-0x%p\n" | 536 | KERN_INFO " stack = 0x%p-0x%p\n" |
536 | KERN_INFO " init = 0x%p-0x%p\n" | 537 | KERN_INFO " init = 0x%p-0x%p\n" |
537 | KERN_INFO " bss = 0x%p-0x%p\n" | ||
538 | KERN_INFO " available = 0x%p-0x%p\n" | 538 | KERN_INFO " available = 0x%p-0x%p\n" |
539 | #ifdef CONFIG_MTD_UCLINUX | 539 | #ifdef CONFIG_MTD_UCLINUX |
540 | KERN_INFO " rootfs = 0x%p-0x%p\n" | 540 | KERN_INFO " rootfs = 0x%p-0x%p\n" |
@@ -544,12 +544,12 @@ static __init void memory_setup(void) | |||
544 | #endif | 544 | #endif |
545 | , _stext, _etext, | 545 | , _stext, _etext, |
546 | __start_rodata, __end_rodata, | 546 | __start_rodata, __end_rodata, |
547 | __bss_start, __bss_stop, | ||
547 | _sdata, _edata, | 548 | _sdata, _edata, |
548 | (void *)&init_thread_union, | 549 | (void *)&init_thread_union, |
549 | (void *)((int)(&init_thread_union) + 0x2000), | 550 | (void *)((int)(&init_thread_union) + 0x2000), |
550 | __init_begin, __init_end, | 551 | __init_begin, __init_end, |
551 | __bss_start, __bss_stop, | 552 | (void *)_ramstart, (void *)memory_end |
552 | (void *)_ramstart, (void *)memory_end | ||
553 | #ifdef CONFIG_MTD_UCLINUX | 553 | #ifdef CONFIG_MTD_UCLINUX |
554 | , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size) | 554 | , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size) |
555 | #endif | 555 | #endif |
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S index 858722421b40..aed832540b3b 100644 --- a/arch/blackfin/kernel/vmlinux.lds.S +++ b/arch/blackfin/kernel/vmlinux.lds.S | |||
@@ -41,6 +41,9 @@ _jiffies = _jiffies_64; | |||
41 | SECTIONS | 41 | SECTIONS |
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 | ||