Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752924AbZIKOJv (ORCPT ); Fri, 11 Sep 2009 10:09:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752687AbZIKOJu (ORCPT ); Fri, 11 Sep 2009 10:09:50 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:49838 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752684AbZIKOJt (ORCPT ); Fri, 11 Sep 2009 10:09:49 -0400 Subject: Re: [PATCH 2/3] tracing/profile: add ref count for registering profile events From: Peter Zijlstra To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Frederic Weisbecker , Li Zefan , Mathieu Desnoyers In-Reply-To: <1252677861.7126.32.camel@laptop> References: <20090911135452.866274568@goodmis.org> <20090911135626.421489476@goodmis.org> <1252677861.7126.32.camel@laptop> Content-Type: text/plain Date: Fri, 11 Sep 2009 16:09:43 +0200 Message-Id: <1252678183.7126.34.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1244 Lines: 42 On Fri, 2009-09-11 at 16:04 +0200, Peter Zijlstra wrote: > On Fri, 2009-09-11 at 09:54 -0400, Steven Rostedt wrote: > > > +#ifdef MODULE > > +# define event_trace_up_ref() \ > > + do { \ > > + if (!try_module_get(THIS_MODULE)) { \ > > + atomic_dec(&event_call->profile_count); \ > > + return -ENOENT; \ > > + } \ > > + } while (0) > > +# define event_trace_down_ref() module_put(THIS_MODULE) > > +#else > > +# define event_trace_up_ref() do { } while (0) > > +# define event_trace_down_ref() do { } while (0) > > +#endif > > That's like truely gruesomely ugly. > > At the very least write it like: > > int event_trace_up_ref(struct ftrace_event_call *call) > { > if (!try_module_get(THIS_MODULE)) { > atomic_dev(&call->profile_count); > return -ENOENT; > } > return 0; > } Or we can go with Li's original patch, that was less ugly. I still think tracepoints/markers should sort this out, because we now have a sematic difference between the two wrt modules. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/