aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2012-03-25 22:20:52 -0400
committerRusty Russell <rusty@rustcorp.com.au>2012-03-25 22:20:52 -0400
commitd53799be6758841e1ffb1fd3780f73d0ffe44432 (patch)
treeaad25045e0bcfe4b4e612d09a0c3abe3beb7e761 /include/linux/module.h
parent026cee0086fe1df4cf74691cf273062cc769617d (diff)
module: move __module_get and try_module_get() out of line.
With the preempt, tracepoint and everything, it's getting a bit chubby. For an Ubuntu-based config: Before: $ size -t `find * -name '*.ko'` | grep TOTAL 56199906 3870760 1606616 61677282 3ad1ee2 (TOTALS) $ size vmlinux text data bss dec hex filename 8509342 850368 3358720 12718430 c2115e vmlinux After: $ size -t `find * -name '*.ko'` | grep TOTAL 56183760 3867892 1606616 61658268 3acd49c (TOTALS) $ size vmlinux text data bss dec hex filename 8501842 849088 3358720 12709650 c1ef12 vmlinux Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (made all out-of-line)
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h32
1 files changed, 4 insertions, 28 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 4598bf03e98b..fbcafe2ee13e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -21,8 +21,6 @@
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22#include <asm/module.h> 22#include <asm/module.h>
23 23
24#include <trace/events/module.h>
25
26/* Not Yet Implemented */ 24/* Not Yet Implemented */
27#define MODULE_SUPPORTED_DEVICE(name) 25#define MODULE_SUPPORTED_DEVICE(name)
28 26
@@ -452,33 +450,11 @@ void symbol_put_addr(void *addr);
452 450
453/* Sometimes we know we already have a refcount, and it's easier not 451/* Sometimes we know we already have a refcount, and it's easier not
454 to handle the error case (which only happens with rmmod --wait). */ 452 to handle the error case (which only happens with rmmod --wait). */
455static inline void __module_get(struct module *module) 453extern void __module_get(struct module *module);
456{
457 if (module) {
458 preempt_disable();
459 __this_cpu_inc(module->refptr->incs);
460 trace_module_get(module, _THIS_IP_);
461 preempt_enable();
462 }
463}
464
465static inline int try_module_get(struct module *module)
466{
467 int ret = 1;
468
469 if (module) {
470 preempt_disable();
471 454
472 if (likely(module_is_live(module))) { 455/* This is the Right Way to get a module: if it fails, it's being removed,
473 __this_cpu_inc(module->refptr->incs); 456 * so pretend it's not there. */
474 trace_module_get(module, _THIS_IP_); 457extern bool try_module_get(struct module *module);
475 } else
476 ret = 0;
477
478 preempt_enable();
479 }
480 return ret;
481}
482 458
483extern void module_put(struct module *module); 459extern void module_put(struct module *module);
484 460