[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110124115156.GA12215@redhat.com>
Date: Mon, 24 Jan 2011 12:51:56 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...e.hu>, mingo@...hat.com, hpa@...or.com,
acme@...hat.com, paulus@...ba.org, linux-kernel@...r.kernel.org,
stern@...land.harvard.edu, a.p.zijlstra@...llo.nl,
fweisbec@...il.com, roland@...hat.com, tglx@...utronix.de,
prasad@...ux.vnet.ibm.com, linux-tip-commits@...r.kernel.org
Subject: Re: [PATCH] perf: perf_event_exit_task_context:
s/rcu_dereference/rcu_dereference_raw/
On 01/21, Paul E. McKenney wrote:
>
> On Fri, Jan 21, 2011 at 06:53:45PM +0100, Oleg Nesterov wrote:
> >
> > But rcu_dereference_raw() looks a bit confusing, and it is not
> > very convenient to use read_barrier_depends() directly.
> >
> > Paul, may be it makes sense to add the new trivial helper which
> > can be used instead?
> >
> > Yes, this is only cosmetic issue, I know ;)
>
> Cosmetic issues can be pretty important to the poor guy trying to read
> the code. ;-)
Agreed!
> What keeps the structure that rcu_dereference_raw() returns a pointer
> to from going away?
It can't go away, current owns its ->perf_event_ctxp[] pointers. But
the pointer can be installed at any time by sys_perf_event_open().
Currently the code does
ctx = current->perf_event_ctxp[ctxn];
if (ctx)
do_something(ctx);
and in theory we need smp_read_barrier_depends() in between.
> Best would be if a lockdep condition could be
> constructed from the answer to this question and added to the appropriate
> rcu_dereference() primitive.
In this case the condition is "true", so we can use rcu_dereference_raw().
The only problem, it looks confusing. Especially because you actually
need rcu_read_lock() if you look at not_current_task->perf_event_ctxp[].
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists