lkml.org 
[lkml]   [2012]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC][PATCH] tracing/module: Move tracepoint out of module.h
From
Date
On Mon, 2012-01-23 at 09:29 +1030, Rusty Russell wrote:
> > could just move the "if" part out.
>
> Agreed. Since GCC should be able to eliminate that branch in almost all
> cases, since it's usually a literal NULL or address of a (non-weak)
> symbol.
>
> Be interesting to see the before/after sizes with this out-of-line.

Using my default test config I got:

text data bss dec hex filename
7489488 2249584 9719808 19458880 128eb40 vmlinux-prepatch
7482458 2248048 9719808 19450314 128c9ca vmlinux-postpatch

An 8k savings!

Rusty,

Can you give my your Acked-by for this patch?

Thanks!

-- Steve

diff --git a/include/linux/module.h b/include/linux/module.h
index 3cb7839..b83a687 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -21,8 +21,6 @@
#include <linux/percpu.h>
#include <asm/module.h>

-#include <trace/events/module.h>
-
/* Not Yet Implemented */
#define MODULE_SUPPORTED_DEVICE(name)

@@ -438,6 +436,7 @@ unsigned int module_refcount(struct module *mod);
void __symbol_put(const char *symbol);
#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
void symbol_put_addr(void *addr);
+void inc_module(struct module *module, unsigned long ip);

/* Sometimes we know we already have a refcount, and it's easier not
to handle the error case (which only happens with rmmod --wait). */
@@ -445,8 +444,7 @@ static inline void __module_get(struct module *module)
{
if (module) {
preempt_disable();
- __this_cpu_inc(module->refptr->incs);
- trace_module_get(module, _THIS_IP_);
+ inc_module(module, _THIS_IP_);
preempt_enable();
}
}
@@ -458,10 +456,9 @@ static inline int try_module_get(struct module *module)
if (module) {
preempt_disable();

- if (likely(module_is_live(module))) {
- __this_cpu_inc(module->refptr->incs);
- trace_module_get(module, _THIS_IP_);
- } else
+ if (likely(module_is_live(module)))
+ inc_module(module, _THIS_IP_);
+ else
ret = 0;

preempt_enable();
diff --git a/kernel/module.c b/kernel/module.c
index 178333c..83c22409 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -928,6 +928,13 @@ void module_put(struct module *module)
}
EXPORT_SYMBOL(module_put);

+void inc_module(struct module *module, unsigned long ip)
+{
+ __this_cpu_inc(module->refptr->incs);
+ trace_module_get(module, ip);
+}
+EXPORT_SYMBOL(inc_module);
+
#else /* !CONFIG_MODULE_UNLOAD */
static inline void print_unload_info(struct seq_file *m, struct module *mod)
{




\
 
 \ /
  Last update: 2012-01-26 03:43    [W:0.108 / U:28.560 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site