Re: [PATCH 2/4] perf_counter: optimize mmap/comm tracking

From: Peter Zijlstra
Date: Thu Apr 09 2009 - 05:26:59 EST


On Thu, 2009-04-09 at 11:16 +0200, Ingo Molnar wrote:
> * Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:
>
> > +static atomic_t nr_comm_tracking __read_mostly;
>
> hm, nr_comm_tracking is not actually used by any fastpath - just
> increased and then decreased.

Index: linux-2.6/kernel/perf_counter.c
===================================================================
--- linux-2.6.orig/kernel/perf_counter.c
+++ linux-2.6/kernel/perf_counter.c
@@ -2018,7 +2018,12 @@ static void perf_counter_comm_event(stru

void perf_counter_comm(struct task_struct *task)
{
- struct perf_comm_event comm_event = {
+ struct perf_comm_event comm_event;
+
+ if (!atomic_read(&nr_comm_tracking))
+ return;
+
+ comm_event = (struct perf_comm_event){
.task = task,
.event = {
.header = { .type = PERF_EVENT_COMM, },


--
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/