public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Hugh Dickins <hugh.dickins@tiscali.co.uk>,
	Ingo Molnar <mingo@elte.hu>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Nathan Fontenot <nfont@austin.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Sachin Sant <sachinp@in.ibm.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Shane Wang <shane.wang@intel.com>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org, Gautham R Shenoy <ego@in.ibm.com>
Subject: Re: [PATCH 2/2] cpuhotplug: make get_online_cpus() scalability by using percpu counter
Date: Mon, 5 Apr 2010 18:29:01 +0200	[thread overview]
Message-ID: <20100405162901.GA3567@redhat.com> (raw)
In-Reply-To: <4BB9BD8A.9040209@cn.fujitsu.com>

On 04/05, Lai Jiangshan wrote:
>
> 1) get_online_cpus() must be allowed to be called recursively, so I added
>    get_online_cpus_nest for every task for new code.

Well, iirc one of the goals of

	cpu-hotplug: replace lock_cpu_hotplug() with get_online_cpus()
	86ef5c9a8edd78e6bf92879f32329d89b2d55b5a

was avoiding the new members in task_struct. I leave this up to you
and Gautham.


Lai, I didn't read this patch carefully yet (and I can't apply it to
Linus's tree). But at first glance,

>  void put_online_cpus(void)
>  {
> ...
> +	if (!--current->get_online_cpus_nest) {
> +		preempt_disable();
> +		__get_cpu_var(refcount)--;
> +		if (cpu_hotplug_task)
> +			wake_up_process(cpu_hotplug_task);

This looks unsafe. In theory nothing protects cpu_hotplug_task from
exiting if refcount_sum() becomes zero, this means wake_up_process()
can hit the freed/reused/unmapped task_struct. Probably cpu_hotplug_done()
needs another synhronize_sched() before return.

OTOH, I do not understand why the result of __get_cpu_var(refcount)
must be visible to refcount_sum() if we race with cpu_hotplug_begin(),
so it seems to me cpu_hotplug_begin() also needs synchronize_sched()
before refcount_sum().

Oleg.


  reply	other threads:[~2010-04-05 17:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 10:38 [PATCH 2/2] cpuhotplug: make get_online_cpus() scalability by using percpu counter Lai Jiangshan
2010-04-05 16:29 ` Oleg Nesterov [this message]
2010-04-06 12:00   ` Oleg Nesterov
2010-04-07 13:35     ` Lai Jiangshan
2010-04-07 13:54       ` Oleg Nesterov
2010-04-09 12:12         ` Oleg Nesterov
2010-04-12  9:24           ` Lai Jiangshan
2010-04-12  9:28             ` Peter Zijlstra
2010-04-12 12:30               ` Lai Jiangshan
2010-04-12 12:34                 ` Peter Zijlstra
2010-04-13  1:47                   ` Lai Jiangshan
2010-04-12 18:16             ` Oleg Nesterov

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=20100405162901.GA3567@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=ego@in.ibm.com \
    --cc=hpa@zytor.com \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nfont@austin.ibm.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=sachinp@in.ibm.com \
    --cc=shane.wang@intel.com \
    --cc=tglx@linutronix.de \
    /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