linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Li Zefan <lizf@cn.fujitsu.com>
Subject: Re: [RFC][PATCH] tracing/module: Move tracepoint out of module.h
Date: Thu, 26 Jan 2012 09:36:46 -0500	[thread overview]
Message-ID: <1327588606.22710.100.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1327586669.22710.89.camel@gandalf.stny.rr.com>

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@goodmis.org> 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)
 {



  parent reply	other threads:[~2012-01-26 14:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 22:57 [PATCH][GIT PULL][v3.3] tracing: Add header wrappers event_headers_start.h and event_headers_end.h Steven Rostedt
2012-01-17  9:54 ` Ingo Molnar
2012-01-17 13:32   ` Steven Rostedt
2012-01-18 12:07     ` Ingo Molnar
2012-01-18 17:56       ` Steven Rostedt
2012-01-22 22:59         ` Rusty Russell
2012-01-26  2:41           ` [RFC][PATCH] tracing/module: Move tracepoint out of module.h Steven Rostedt
2012-01-26  2:45             ` Steven Rostedt
2012-01-26 10:28             ` Ingo Molnar
2012-01-26 13:52               ` Steven Rostedt
2012-01-26 13:55                 ` Ingo Molnar
2012-01-26 14:04                   ` Steven Rostedt
2012-01-26 14:07                     ` Steven Rostedt
2012-01-26 14:36                     ` Steven Rostedt [this message]
2012-01-26 18:39                       ` Ingo Molnar
2012-01-27  3:02                         ` Rusty Russell
2012-01-30 11:52                           ` Steven Rostedt
2012-01-30 17:28                             ` Steven Rostedt
2012-01-31  3:58                             ` Rusty Russell
2012-01-31 12:20                               ` Ingo Molnar
2012-01-31 12:50                                 ` Steven Rostedt
2012-02-01  6:48                                   ` Rusty Russell
2012-02-01 13:27                                     ` Steven Rostedt
2012-02-01 13:49                                     ` Ingo Molnar
2012-02-01 14:25                                       ` Steven Rostedt
2012-03-29  4:22                                     ` Eric Dumazet
2012-03-29  5:24                                       ` Rusty Russell
2012-02-01  1:10                                 ` Rusty Russell
2012-02-01  7:09                                   ` Ingo Molnar
2012-01-30  6:40                       ` Li Zefan
2012-02-17 13:46       ` [tip:perf/core] tracing/softirq: Move __raise_softirq_irqoff() out of header tip-bot for Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1327588606.22710.100.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).