Re: perf: prctl(PR_TASK_PERF_EVENTS_DISABLE) has no effect

From: Gleb Natapov
Date: Sun Jan 29 2012 - 12:51:37 EST


On Sun, Jan 29, 2012 at 05:32:35PM +0100, Ingo Molnar wrote:
>
> * Andrew Steets <asteets@xxxxxxxxxxxxxxx> wrote:
>
> > On 1/28/12 6:01 AM, Ingo Molnar wrote:
> >
> > >> prctl(PR_TASK_PERF_EVENTS_DISABLE) doesn't appear to
> > >> disable perf event counters. Here is a demonstration
> > >> program:
> > >
> > > btw., what's your usecase?
> >
> > I'm trying to profile a small section of a long-running
> > program. I ran into trouble using call-graph recording and I
> > thought this might be an alternative way of getting what I was
> > after.
>
> That usecase indeed makes sense. Peter, could we allow this for
> privileged tasks, depending on the perf_paranoia settings or
> such?
>
This sounds useful not only for privileged tasks. Why not make
it event attribute? If user wants PR_TASK_PERF_EVENTS_DISABLE be
respected for an event it can specify special argument like:

perf record -e cycles:n ./a.out

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