optimize __gp location

From: Chen, Kenneth W <kenneth.w.chen_at_intel.com>
Date: 2005-01-22 10:22:18
__gp is positioned so far out that it is almost at the end of all data
sections.  On 2.6.11-rc1, 80% of kernel data symbols are out of 22-bit
immediate offset from __gp.  This means accessing these symbols are 
unnecessarily expansive such that they have to go through global offset
table (a memory load to get the symbol address).  Among these out of
reach symbols from __gp, some are very frequently used, like Jiffies,
etc.

Can we position the __gp somewhat more optimally, to cover more of these
symbols? Something like the following patch would make all of them fall
into the 22-bit immediate offset relative to gp.

--- linux-2.6.11-rc1/arch/ia64/kernel/vmlinux.lds.S.orig
2005-01-21 11:43:57.000000000 -0800
+++ linux-2.6.11-rc1/arch/ia64/kernel/vmlinux.lds.S	2005-01-21
14:45:29.000000000 -0800
@@ -193,7 +193,7 @@ SECTIONS
   . = ALIGN(16);	/* gp must be 16-byte aligned for exc. table */
   .got : AT(ADDR(.got) - LOAD_OFFSET)
 	{ *(.got.plt) *(.got) }
-  __gp = ADDR(.got) + 0x200000;
+  __gp = _end - 0x200000;
   /* We want the small data sections together, so single-instruction
offsets
      can access them all, and initialized data all before
uninitialized, so
      we can shorten the on-disk segment size.  */
@@ -205,7 +205,7 @@ SECTIONS
 	{ *(.sbss) *(.scommon) }
   .bss : AT(ADDR(.bss) - LOAD_OFFSET)
 	{ *(.bss) *(COMMON) }
-
+  . = ALIGN(16);
   _end = .;
 
   code : { } :code

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Jan 21 19:41:03 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:34 EST