Re: [RFC][PATCH] tracing/module: Move tracepoint out of module.h

From: Steven Rostedt
Date: Thu Jan 26 2012 - 09:36:48 EST


On Thu, 2012-01-26 at 09:04 -0500, Steven Rostedt wrote:
> [ Added Li who added the original tracepoint ]
>
> On Thu, 2012-01-26 at 14:55 +0100, Ingo Molnar wrote:
> > * Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > > On Thu, 2012-01-26 at 11:28 +0100, Ingo Molnar wrote:
> > >
> > > > How much more do we save if we move all of try_module_get() out
> > > > of line? It still seems a rather thick inline function with
> > > > preempt section and all. I'd *really* suggest that it should all
> > > > be uninlined.
> > > >
> > >
> > > Here's the #'s
> > >
> > > text data bss dec hex filename
> > > 7489488 2249584 9719808 19458880 128eb40 vmlinux-prepatch
> > > text data bss dec hex filename
> > > 7482458 2248048 9719808 19450314 128c9ca vmlinux-postpatch
> > > text data bss dec hex filename
> > > 7477393 2248080 9719808 19445281 128b621 vmlinux-updatedpatch


New numbers:

text data bss dec hex filename
7476509 2248048 9719808 19444365 128b28d vmlinux-updatedpatch2

Just 916 bytes savings more. But gets rid of the hot path changes.

New patch below: (and the IP still works)

-- Steve

diff --git a/include/linux/module.h b/include/linux/module.h
index 3cb7839..ef928b9 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)

@@ -439,36 +437,8 @@ void __symbol_put(const char *symbol);
#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
void symbol_put_addr(void *addr);

-/* Sometimes we know we already have a refcount, and it's easier not
- to handle the error case (which only happens with rmmod --wait). */
-static inline void __module_get(struct module *module)
-{
- if (module) {
- preempt_disable();
- __this_cpu_inc(module->refptr->incs);
- trace_module_get(module, _THIS_IP_);
- preempt_enable();
- }
-}
-
-static inline int try_module_get(struct module *module)
-{
- int ret = 1;
-
- if (module) {
- preempt_disable();
-
- if (likely(module_is_live(module))) {
- __this_cpu_inc(module->refptr->incs);
- trace_module_get(module, _THIS_IP_);
- } else
- ret = 0;
-
- preempt_enable();
- }
- return ret;
-}
-
+extern void __module_get(struct module *module);
+extern int try_module_get(struct module *module);
extern void module_put(struct module *module);

#else /*!CONFIG_MODULE_UNLOAD*/
diff --git a/kernel/module.c b/kernel/module.c
index 178333c..c3dca5c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -928,6 +928,38 @@ void module_put(struct module *module)
}
EXPORT_SYMBOL(module_put);

+/* Sometimes we know we already have a refcount, and it's easier not
+ to handle the error case (which only happens with rmmod --wait). */
+void __module_get(struct module *module)
+{
+ if (module) {
+ preempt_disable();
+ __this_cpu_inc(module->refptr->incs);
+ trace_module_get(module, _RET_IP_);
+ preempt_enable();
+ }
+}
+EXPORT_SYMBOL(__module_get);
+
+int try_module_get(struct module *module)
+{
+ int ret = 1;
+
+ if (module) {
+ preempt_disable();
+
+ if (likely(module_is_live(module))) {
+ __this_cpu_inc(module->refptr->incs);
+ trace_module_get(module, _RET_IP_);
+ } else
+ ret = 0;
+
+ preempt_enable();
+ }
+ return ret;
+}
+EXPORT_SYMBOL(try_module_get);
+
#else /* !CONFIG_MODULE_UNLOAD */
static inline void print_unload_info(struct seq_file *m, struct module *mod)
{


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/