summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-03-03 09:24:45 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2009-03-03 09:24:45 +1100
commit8e2cf4b89747f3bb9e83395078487fb41e7e7bd5 (patch)
tree679b1c2904f325599ffa331572087d153278d081 /kernel
parent5ad2c28c1b88b9a92138b72f8fa820b41e79ca72 (diff)
module:dont-load-__versions-section
Impact: reduce kernel memory usage This patch just takes off the SHF_ALLOC flag on __versions so we don't keep them around after module load. This saves about 7% of module memory if CONFIG_MODVERSIONS=y. Cc: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 4c5ca12447a6..75865f0e756d 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1930,6 +1930,9 @@ static noinline struct module *load_module(void __user *umod,
if (strstarts(secstrings+sechdrs[i].sh_name, ".exit"))
sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;
#endif
+ /* Don't keep __versions around; it's just for loading. */
+ if (strcmp(secstrings + sechdrs[i].sh_name, "__versions") == 0)
+ sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;
}
modindex = find_sec(hdr, sechdrs, secstrings,