Peter Williams wrote: > Andrew Morton wrote: >> On Sun, 18 Jun 2006 18:26:38 +1000 >> Peter Williams wrote: >>> 5. Code size measurements: >>> >>> Vanilla kernel: >>> >>> text data bss dec hex filename >>> 33800 4689 296 38785 9781 sched.o >>> 2554 79 0 2633 a49 mutex.o >>> 12076 2632 0 14708 3974 base.o >>> >>> Patches applied: >>> >>> text data bss dec hex filename >>> 36870 4721 296 41887 a39f sched.o >>> 2630 79 0 2709 a95 mutex.o >>> 13011 2920 0 15931 3e3b base.o >>> >>> Indicating that the size cost of the patch proper is about >>> 3 kilobytes and the procfs costs about another 1.2 kilobytes. >>> >> >> hm. That seems rather a lot. I guess it's not a simple thing to do. > > I suspect that a large part of that is the functions that set the caps > (i.e. the equivalents of set_user_nice()) one for soft and one for hard > caps. The actual capping mechanisms are quite simple. This contribution may not be as large as I thought. Realizing that the function to set soft caps and the function to set hard caps duplicate a lot of code I've modified them to share code rather than duplicate. I've also made the functions for getting caps inline and they should just be optimized away to a field reference. But the reduction in code size is only about 285 bytes. Before: text data bss dec hex filename 32820 4913 672 38405 9605 kernel/sched.o After: text data bss dec hex filename 32535 4913 672 38120 94e8 kernel/sched.o Noting that these values were less than those in the original mail, I've also checked the size for when the patches are excluded. text data bss dec hex filename 30061 4881 672 35614 8b1e kernel/sched.o The numbers in the e-mail were from a different computer with gcc-4.0.2 installed while these are generated with gcc-4.1.1 (also that build would not have had CONFIG_SCHED_SMT or CONFIG_SCHED_MC set). But the end result is that the cost is still of the order of 2.5 kilobytes. A patch to make these changes is attached. Signed-off-by: Peter Williams Peter -- Peter Williams pwil3058@bigpond.net.au "Learning, n. The kind of ignorance distinguishing the studious." -- Ambrose Bierce