From: Steven Rostedt on
On Wed, 2010-03-24 at 10:57 +0800, Li Zefan wrote:
> Remove the @refcnt argument, because it has side-effects, and
> arguments with side-effects are not skipped by the jump over
> disabled instrumentation, so it adds overhead even when the
> tracepoints are disabled.

Thanks, I'll get this ready for 34.

-- Steve

>
> Signed-off-by: Li Zefan <lizf(a)cn.fujitsu.com>
> ---
> include/linux/module.h | 6 ++----
> include/trace/events/module.h | 14 +++++++-------
> kernel/module.c | 3 +--
> 3 files changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 5e869ff..393ec39 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -460,8 +460,7 @@ static inline void __module_get(struct module *module)
> if (module) {
> preempt_disable();
> __this_cpu_inc(module->refptr->count);
> - trace_module_get(module, _THIS_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_get(module, _THIS_IP_);
> preempt_enable();
> }
> }
> @@ -475,8 +474,7 @@ static inline int try_module_get(struct module *module)
>
> if (likely(module_is_live(module))) {
> __this_cpu_inc(module->refptr->count);
> - trace_module_get(module, _THIS_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_get(module, _THIS_IP_);
> }
> else
> ret = 0;
> diff --git a/include/trace/events/module.h b/include/trace/events/module.h
> index 4b0f48b..a585f81 100644
> --- a/include/trace/events/module.h
> +++ b/include/trace/events/module.h
> @@ -53,9 +53,9 @@ TRACE_EVENT(module_free,
>
> DECLARE_EVENT_CLASS(module_refcnt,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt),
> + TP_ARGS(mod, ip),
>
> TP_STRUCT__entry(
> __field( unsigned long, ip )
> @@ -65,7 +65,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
>
> TP_fast_assign(
> __entry->ip = ip;
> - __entry->refcnt = refcnt;
> + __entry->refcnt = __this_cpu_read(mod->refptr->count);
> __assign_str(name, mod->name);
> ),
>
> @@ -75,16 +75,16 @@ DECLARE_EVENT_CLASS(module_refcnt,
>
> DEFINE_EVENT(module_refcnt, module_get,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt)
> + TP_ARGS(mod, ip)
> );
>
> DEFINE_EVENT(module_refcnt, module_put,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt)
> + TP_ARGS(mod, ip)
> );
>
> TRACE_EVENT(module_request,
> diff --git a/kernel/module.c b/kernel/module.c
> index c968d36..21591ad 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -800,8 +800,7 @@ void module_put(struct module *module)
> preempt_disable();
> __this_cpu_dec(module->refptr->count);
>
> - trace_module_put(module, _RET_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_put(module, _RET_IP_);
> /* Maybe they're waiting for us to drop reference? */
> if (unlikely(!module_is_live(module)))
> wake_up_process(module->waiter);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Mathieu Desnoyers on
* Li Zefan (lizf(a)cn.fujitsu.com) wrote:
> Remove the @refcnt argument, because it has side-effects, and
> arguments with side-effects are not skipped by the jump over
> disabled instrumentation, so it adds overhead even when the
> tracepoints are disabled.


Thanks Li.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers(a)efficios.com>

>
> Signed-off-by: Li Zefan <lizf(a)cn.fujitsu.com>
> ---
> include/linux/module.h | 6 ++----
> include/trace/events/module.h | 14 +++++++-------
> kernel/module.c | 3 +--
> 3 files changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 5e869ff..393ec39 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -460,8 +460,7 @@ static inline void __module_get(struct module *module)
> if (module) {
> preempt_disable();
> __this_cpu_inc(module->refptr->count);
> - trace_module_get(module, _THIS_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_get(module, _THIS_IP_);
> preempt_enable();
> }
> }
> @@ -475,8 +474,7 @@ static inline int try_module_get(struct module *module)
>
> if (likely(module_is_live(module))) {
> __this_cpu_inc(module->refptr->count);
> - trace_module_get(module, _THIS_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_get(module, _THIS_IP_);
> }
> else
> ret = 0;
> diff --git a/include/trace/events/module.h b/include/trace/events/module.h
> index 4b0f48b..a585f81 100644
> --- a/include/trace/events/module.h
> +++ b/include/trace/events/module.h
> @@ -53,9 +53,9 @@ TRACE_EVENT(module_free,
>
> DECLARE_EVENT_CLASS(module_refcnt,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt),
> + TP_ARGS(mod, ip),
>
> TP_STRUCT__entry(
> __field( unsigned long, ip )
> @@ -65,7 +65,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
>
> TP_fast_assign(
> __entry->ip = ip;
> - __entry->refcnt = refcnt;
> + __entry->refcnt = __this_cpu_read(mod->refptr->count);
> __assign_str(name, mod->name);
> ),
>
> @@ -75,16 +75,16 @@ DECLARE_EVENT_CLASS(module_refcnt,
>
> DEFINE_EVENT(module_refcnt, module_get,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt)
> + TP_ARGS(mod, ip)
> );
>
> DEFINE_EVENT(module_refcnt, module_put,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt)
> + TP_ARGS(mod, ip)
> );
>
> TRACE_EVENT(module_request,
> diff --git a/kernel/module.c b/kernel/module.c
> index c968d36..21591ad 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -800,8 +800,7 @@ void module_put(struct module *module)
> preempt_disable();
> __this_cpu_dec(module->refptr->count);
>
> - trace_module_put(module, _RET_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_put(module, _RET_IP_);
> /* Maybe they're waiting for us to drop reference? */
> if (unlikely(!module_is_live(module)))
> wake_up_process(module->waiter);
> --
> 1.6.3
>

--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Randy Dunlap on
On 03/23/10 19:57, Li Zefan wrote:
> Remove the @refcnt argument, because it has side-effects, and
> arguments with side-effects are not skipped by the jump over
> disabled instrumentation, so it adds overhead even when the
> tracepoints are disabled.
>
> Signed-off-by: Li Zefan <lizf(a)cn.fujitsu.com>

Tested-by: Randy Dunlap <randy.dunlap(a)oracle.com>

Thanks.

> ---
> include/linux/module.h | 6 ++----
> include/trace/events/module.h | 14 +++++++-------
> kernel/module.c | 3 +--
> 3 files changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 5e869ff..393ec39 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -460,8 +460,7 @@ static inline void __module_get(struct module *module)
> if (module) {
> preempt_disable();
> __this_cpu_inc(module->refptr->count);
> - trace_module_get(module, _THIS_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_get(module, _THIS_IP_);
> preempt_enable();
> }
> }
> @@ -475,8 +474,7 @@ static inline int try_module_get(struct module *module)
>
> if (likely(module_is_live(module))) {
> __this_cpu_inc(module->refptr->count);
> - trace_module_get(module, _THIS_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_get(module, _THIS_IP_);
> }
> else
> ret = 0;
> diff --git a/include/trace/events/module.h b/include/trace/events/module.h
> index 4b0f48b..a585f81 100644
> --- a/include/trace/events/module.h
> +++ b/include/trace/events/module.h
> @@ -53,9 +53,9 @@ TRACE_EVENT(module_free,
>
> DECLARE_EVENT_CLASS(module_refcnt,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt),
> + TP_ARGS(mod, ip),
>
> TP_STRUCT__entry(
> __field( unsigned long, ip )
> @@ -65,7 +65,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
>
> TP_fast_assign(
> __entry->ip = ip;
> - __entry->refcnt = refcnt;
> + __entry->refcnt = __this_cpu_read(mod->refptr->count);
> __assign_str(name, mod->name);
> ),
>
> @@ -75,16 +75,16 @@ DECLARE_EVENT_CLASS(module_refcnt,
>
> DEFINE_EVENT(module_refcnt, module_get,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt)
> + TP_ARGS(mod, ip)
> );
>
> DEFINE_EVENT(module_refcnt, module_put,
>
> - TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
> + TP_PROTO(struct module *mod, unsigned long ip),
>
> - TP_ARGS(mod, ip, refcnt)
> + TP_ARGS(mod, ip)
> );
>
> TRACE_EVENT(module_request,
> diff --git a/kernel/module.c b/kernel/module.c
> index c968d36..21591ad 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -800,8 +800,7 @@ void module_put(struct module *module)
> preempt_disable();
> __this_cpu_dec(module->refptr->count);
>
> - trace_module_put(module, _RET_IP_,
> - __this_cpu_read(module->refptr->count));
> + trace_module_put(module, _RET_IP_);
> /* Maybe they're waiting for us to drop reference? */
> if (unlikely(!module_is_live(module)))
> wake_up_process(module->waiter);


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