mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>,
	paulmck@linux.vnet.ibm.com, Ingo Molnar <mingo@elte.hu>,
	eric.dumazet@gmail.com, shaohua.li@intel.com, ak@linux.intel.com,
	mhocko@suse.cz, alex.shi@intel.com, efault@gmx.de,
	linux-kernel@vger.kernel.org, Paul Turner <pjt@google.com>
Subject: Re: [GIT PULL rcu/next] RCU commits for 3.1
Date: Mon, 07 Nov 2011 17:35:56 +0100	[thread overview]
Message-ID: <1320683756.17809.28.camel@twins> (raw)
In-Reply-To: <CABPqkBTbWE6wVkg_sFnoVL0r4_yi6gCwCoUXzC97kxcxC47zYQ@mail.gmail.com>

On Mon, 2011-11-07 at 16:16 +0000, Stephane Eranian wrote:
> On Mon, Nov 7, 2011 at 3:15 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> > So far nobody seems to have stated if this is an actual problem or just
> > shutting up lockdep-prove-rcu? I very much suspect the latter, in which
> > case I really utterly hate the patch because it adds instructions to
> > fast-paths just to kill a debug warning.
> >
> I think the core issue at stake here is not so much the cgroup disappearing.
> It cannot go away because it is ref counted (perf_events does the necessary
> css_get()/css_put()). But it is rather the task disappearing while we
> are operating
> on its state.
> 
> I don't think task (prev or next) can disappear while we execute
> perf_cgroup_sched_out()/perf_cgroup_sched_in() because we are in the context
> switch code.

Right.

> What remains is:
>   * update_cgrp_time_from_event()
>     alway operates on current task
> 
>   * perf_cgroup_set_timestamp()
> 
>        - perf_event_task_tick() -> cpu_ctx_sched_in() but in this case
> it is on the current task
>        - perf_event_task_sched_in() in context switch code so I assume
> it is safe
>        - __perf_event_enable() but it is called on current
> 
>   - perf_cgroup_switch()
>     * perf_cgroup_sched_in()/perf_cgroup_sched_out() -> context switch code
> 
>     * perf_cgroup_attach()
>       called from cgroup code. Does not appear to hold task_lock().
>       the routine already grabs the rcu_read_lock() but it that enough
> to guarantee the task cannot
>       vanish. I would hope so, otherwise I think the cgroup attach
> code has a problem.

yeah, task_struct is rcu-freed

> In summary, unless I am mistaken, it looks to me that we may not need
> those new rcu_read_lock()
> calls after all.
> 
> Does anyone have a different analysis? 

The only other problem I could see is that perf_cgroup_sched_{in,out}
can race against perf_cgroup_attach_task() and make the wrong decision.
But then perf_cgroup_attach will call perf_cgroup_switch() to fix that
up again.





  reply	other threads:[~2011-11-07 16:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110930204503.GA32687@linux.vnet.ibm.com>
     [not found] ` <20111001152514.GA16930@elte.hu>
     [not found]   ` <20111003055302.GA23527@elte.hu>
     [not found]     ` <20111003161335.GA2403@linux.vnet.ibm.com>
2011-10-04  7:46       ` Ingo Molnar
2011-10-24 10:05         ` Paul E. McKenney
2011-10-24 11:48           ` Paul E. McKenney
2011-10-26 20:30             ` Ingo Molnar
2011-10-27  7:59               ` Paul E. McKenney
2011-10-27  8:00                 ` Ingo Molnar
2011-10-28  2:34                   ` Li Zefan
2011-10-29 18:27                     ` Paul E. McKenney
2011-10-31  8:09                       ` Li Zefan
2011-10-31  9:32                         ` Paul E. McKenney
2011-11-01  2:37                           ` Li Zefan
2011-11-02 19:23                             ` Paul E. McKenney
2011-11-02 19:55                               ` Stephane Eranian
2011-11-03 12:50                             ` Stephane Eranian
2011-11-04  8:44                               ` Li Zefan
2011-11-04  9:02                                 ` Stephane Eranian
2011-11-07 14:24                                   ` Stephane Eranian
2011-11-07 14:41                                     ` Eric Dumazet
2011-11-07 14:44                                       ` Stephane Eranian
2011-11-07 15:15                             ` Peter Zijlstra
2011-11-07 16:16                               ` Stephane Eranian
2011-11-07 16:35                                 ` Peter Zijlstra [this message]
2011-11-07 16:56                                   ` Paul E. McKenney
2011-11-07 17:09                                     ` Peter Zijlstra
2011-11-07 17:55                                       ` Paul E. McKenney
2011-11-08 13:10                                         ` Stephane Eranian
2011-11-07 17:11                                     ` Peter Zijlstra
2011-11-07 17:12                                     ` Stephane Eranian
2011-11-07 17:26                                       ` Peter Zijlstra
2011-11-07 17:50                                         ` Stephane Eranian
2011-11-07 17:53                                         ` Paul E. McKenney
2011-11-07 17:53                                       ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320683756.17809.28.camel@twins \
    --to=peterz@infradead.org \
    --cc=ak@linux.intel.com \
    --cc=alex.shi@intel.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mhocko@suse.cz \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pjt@google.com \
    --cc=shaohua.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome