From 4bdc3b7f1b730c07f5a6ccca77ee68e044036ffc Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Sat, 25 Mar 2006 16:30:49 +0100 Subject: [PATCH] x86_64: Basic reorder infrastructure This patch puts the infrastructure in place to allow for a reordering of functions based inside the vmlinux. The general idea is that it is possible to put all "common" functions into the first 2Mb of the code, so that they are covered by one TLB entry. This as opposed to the current situation where a typical vmlinux covers about 3.5Mb (on x86-64) and thus 2 TLB entries. This is done by enabling the -ffunction-sections flag in gcc, which puts each function in its own ELF section, so that the linker can then order them in a way defined by the linker script. As per previous discussions, Linus said he wanted a "static" list for this, eg a list provided by the kernel tarbal, so that most people have the same ordering at least. A script is provided to create this list based on readprofile(1) output. The included list is provisional, and entirely biased on my own testbox and me running a few kernel compiles and some other things. I think that to get to a better list we need to invite people to submit their own profiles, and somehow add those all up and base the final list on that. I'm willing to do that effort if this is ends up being the prefered approach. Such an effort probably needs to be repeated like once a year or so to adopt to the changing nature of the kernel. Made it a CONFIG with default n because it increases link times dramatically. Signed-off-by: Andi Kleen Signed-off-by: Linus Torvalds --- scripts/profile2linkerlist.pl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/profile2linkerlist.pl (limited to 'scripts') diff --git a/scripts/profile2linkerlist.pl b/scripts/profile2linkerlist.pl new file mode 100644 index 000000000000..cb4260ebdb91 --- /dev/null +++ b/scripts/profile2linkerlist.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +# +# Takes a (sorted) output of readprofile and turns it into a list suitable for +# linker scripts +# +# usage: +# readprofile | sort -rn | perl profile2linkerlist.pl > functionlist +# + +while (<>) { + my $line = $_; + + $_ =~ /\W*[0-9]+\W*([a-zA-Z\_0-9]+)\W*[0-9]+/; + + if ( ($line =~ /unknown/) || ($line =~ /total/)) { + + } else { + print "*(.text.$1)\n"; + } +} -- cgit v1.2.3-59-g8ed1b