Title: [4192] trunk/arch/blackfin/kernel: restore r3827 ( and include uClinux-dist this time):
Revision
4192
Author
vapier
Date
2008-01-30 17:39:45 -0600 (Wed, 30 Jan 2008)

Log Message

restore r3827 (and include uClinux-dist this time):
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.

Diffstat

 init_task.c   |    2 +-
 setup.c       |   14 +++++++-------
 vmlinux.lds.S |   47 ++++++++++++++++++++++++++++-------------------
 3 files changed, 36 insertions(+), 27 deletions(-)

Modified Paths

Diff

Modified: trunk/arch/blackfin/kernel/init_task.c (4191 => 4192)


--- trunk/arch/blackfin/kernel/init_task.c	2008-01-30 22:39:25 UTC (rev 4191)
+++ trunk/arch/blackfin/kernel/init_task.c	2008-01-30 23:39:45 UTC (rev 4192)
@@ -56,5 +56,5 @@
  * "init_task" linker map entry.
  */
 union thread_union init_thread_union
-    __attribute__ ((__section__(".data.init_task"))) = {
+    __attribute__ ((__section__(".init_task.data"))) = {
 INIT_THREAD_INFO(init_task)};

Modified: trunk/arch/blackfin/kernel/setup.c (4191 => 4192)


--- trunk/arch/blackfin/kernel/setup.c	2008-01-30 22:39:25 UTC (rev 4191)
+++ trunk/arch/blackfin/kernel/setup.c	2008-01-30 23:39:45 UTC (rev 4192)
@@ -431,7 +431,7 @@
 #endif
 
 	_rambase = (unsigned long)_stext;
-	_ramstart = (unsigned long)__bss_stop;
+	_ramstart = (unsigned long)_end;
 
 	if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) {
 		console_init();
@@ -493,7 +493,7 @@
 	}
 
 	/* Relocate MTD image to the top of memory after the uncached memory area */
-	dma_memcpy((char *)memory_end, __bss_stop, mtd_size);
+	dma_memcpy((char *)memory_end, _end, mtd_size);
 
 	memory_mtd_start = memory_end;
 	_ebss = memory_mtd_start;	/* define _ebss for compatible */
@@ -532,13 +532,13 @@
 	printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
 	printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
 
-	printk( KERN_INFO "Memory map:\n"
+	printk(KERN_INFO "Memory map:\n"
 		KERN_INFO "  text      = 0x%p-0x%p\n"
 		KERN_INFO "  rodata    = 0x%p-0x%p\n"
+		KERN_INFO "  bss       = 0x%p-0x%p\n"
 		KERN_INFO "  data      = ""
 		KERN_INFO "    stack   = 0x%p-0x%p\n"
 		KERN_INFO "  init      = 0x%p-0x%p\n"
-		KERN_INFO "  bss       = 0x%p-0x%p\n"
 		KERN_INFO "  available = 0x%p-0x%p\n"
 #ifdef CONFIG_MTD_UCLINUX
 		KERN_INFO "  rootfs    = 0x%p-0x%p\n"
@@ -548,12 +548,12 @@
 #endif
 		, _stext, _etext,
 		__start_rodata, __end_rodata,
+		__bss_start, __bss_stop,
 		_sdata, _edata,
 		(void *)&init_thread_union,
 		(void *)((int)(&init_thread_union) + 0x2000),
-	       __init_begin, __init_end,
-	       __bss_start, __bss_stop,
-	       (void *)_ramstart, (void *)memory_end
+		__init_begin, __init_end,
+		(void *)_ramstart, (void *)memory_end
 #ifdef CONFIG_MTD_UCLINUX
 		, (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
 #endif

Modified: trunk/arch/blackfin/kernel/vmlinux.lds.S (4191 => 4192)


--- trunk/arch/blackfin/kernel/vmlinux.lds.S	2008-01-30 22:39:25 UTC (rev 4191)
+++ trunk/arch/blackfin/kernel/vmlinux.lds.S	2008-01-30 23:39:45 UTC (rev 4192)
@@ -41,6 +41,9 @@
 SECTIONS
 {
 	. = CONFIG_BOOT_LOAD;
+	/* Neither the text, ro_data or bss section need to be aligned
+	 * So pack them back to back
+	 */
 	.text :
 	{
 		__text = .;
@@ -58,22 +61,25 @@
 		*(__ex_table)
 		___stop___ex_table = .;
 
-		. = ALIGN(4);
 		__etext = .;
 	}
 
-	RO_DATA(PAGE_SIZE)
+	/* Just in case the first read only is a 32-bit access */
+	RO_DATA(4)
 
+	.bss :
+	{
+		. = ALIGN(4);
+		___bss_start = .;
+		*(.bss .bss.*)
+		*(COMMON)
+		___bss_stop = .;
+	}
+
 	.data :
 	{
-		/* make sure the init_task is aligned to the
-		 * kernel thread size so we can locate the kernel
-		 * stack properly and quickly.
-		 */
 		__sdata = .;
-		. = ALIGN(THREAD_SIZE);
-		*(.data.init_task)
-
+		/* This gets done first, so the glob doesn't suck it in */
 		. = ALIGN(32);
 		*(.data.cacheline_aligned)
 
@@ -81,10 +87,22 @@
 		*(.data.*)
 		CONSTRUCTORS
 
+		/* make sure the init_task is aligned to the
+		 * kernel thread size so we can locate the kernel
+		 * stack properly and quickly.
+		 */
 		. = ALIGN(THREAD_SIZE);
+		*(.init_task.data)
+
 		__edata = .;
 	}
 
+	/* The init section should be last, so when we free it, it goes into
+	 * the general memory pool, and (hopefully) will decrease fragmentation
+	 * a tiny bit. The init section has a _requirement_ that it be
+	 * PAGE_SIZE aligned
+	 */
+	. = ALIGN(PAGE_SIZE);
 	___init_begin = .;
 
 	.init.text :
@@ -179,16 +197,7 @@
 	. = ALIGN(PAGE_SIZE);
 	___init_end = .;
 
-	.bss :
-	{
-		. = ALIGN(4);
-		___bss_start = .;
-		*(.bss .bss.*)
-		*(COMMON)
-		. = ALIGN(4);
-		___bss_stop = .;
-		__end = .;
-	}
+	__end =.;
 
 	STABS_DEBUG
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to