On Wed, 2013-07-03 at 00:23 +0200, Oleg Nesterov wrote: > On 07/02, Oleg Nesterov wrote: > > > > So please ignore modules ;) > > Or lets discuss the change above.
I like this better than your first change, as the module code really can't fail to remove events, as that will complicate things more than they already are ;-) > > Oleg. > > --- x/kernel/trace/trace_events.c > +++ x/kernel/trace/trace_events.c > @@ -1611,14 +1611,40 @@ static void __trace_remove_event_call(st > destroy_preds(call); > } > > +static int event_can_remove(struct ftrace_event_call *call) Should rename this to "event_is_busy" as we are only seeing if the event is active or not, as we do allow for events to be removed when active. This may confuse new reviewers. > +{ > + struct trace_array *tr; > + struct ftrace_event_file *file; > + > +#ifdef CONFIG_PERF_EVENTS > + if (call->perf_refcount) > + return -EBUSY; > +#endif > + do_for_each_event_file(tr, file) { > + if (file->event_call != call) > + continue; > + if (file->flags & FTRACE_EVENT_FL_ENABLED) > + return -EBUSY; > + break; > + } while_for_each_event_file(); > + > + return 0; > +} > + > /* Remove an event_call */ > -void trace_remove_event_call(struct ftrace_event_call *call) > +int trace_remove_event_call(struct ftrace_event_call *call) Probably should rename this to trace_probe_remove_event_call() as this deals only with the probe callers (kprobe and uprobe). Also this code will need to be documented a bit more. Other than that, sure, go with it. Masami, you have any comments? -- Steve > { > + int err; > + > mutex_lock(&event_mutex); > down_write(&trace_event_sem); > - __trace_remove_event_call(call); > + err = event_can_remove(call); > + if (!err) > + __trace_remove_event_call(call); > up_write(&trace_event_sem); > mutex_unlock(&event_mutex); > + > + return err; > } > > #define for_each_event(event, start, end) \ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/