diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-03 09:24:45 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-03-03 09:24:45 +1100 |
commit | 8e2cf4b89747f3bb9e83395078487fb41e7e7bd5 (patch) | |
tree | 679b1c2904f325599ffa331572087d153278d081 | |
parent | 5ad2c28c1b88b9a92138b72f8fa820b41e79ca72 (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>
-rw-r--r-- | kernel/module.c | 3 |
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, |