public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@kernel.dk>
To: Tejun Heo <tj@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Nick Piggin <npiggin@kernel.dk>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lglock: make lg_lock_global() actually lock globally
Date: Thu, 26 Aug 2010 19:46:13 +1000	[thread overview]
Message-ID: <20100826094613.GA6411@amd> (raw)
In-Reply-To: <4C762BF9.5010305@kernel.org>

On Thu, Aug 26, 2010 at 10:55:21AM +0200, Tejun Heo wrote:
> Hello,
> 
> On 08/25/2010 10:00 PM, Linus Torvalds wrote:
> >> lg_lock_global() currently only acquires spinlocks for online CPUs, but
> >> it's meant to lock all possible CPUs.  At Nick's suggestion, change
> >> for_each_online_cpu() to for_each_possible_cpu() to get the expected
> >> behavior.
> > 
> > Can you say what this actually matters for? Don't we do stop-machine
> > for CPU hotplug anyway? And if we don't, shouldn't we? Exactly because
> > otherwise "for_each_online_cpu()" is always racy (and that has nothing
> > to do with the lglock).
> 
> We only do stop-machine for cpu downs not ups, so code running w/
> preemption disabled is guaranteed that no cpu goes down while it's
> running but not the other way around.  There are two ways to achieve
> synchronization against cpu up/down operations.  One is explicitly
> using get/put_online_cpus() and the other is via cpu notifiers with
> proper synchronization.

Oh, I thought we quiesce / preempt all online cpus before adding
another one. That sucks if we don't because then you need a big
heavy get_online_cpus when a simple preempt_disable would have
worked.

Why is that? Don't tell me realtime people want some latency "guarantee"
while onlining CPUs? :)

> 
> So, yeah, given that there's no cpu notifier implemented, the use of
> for_each_online_cpu for brlock seems fishy to me.  It probably should
> use for_each_possible_cpu().

It should if that's the case, yes.

Thanks,
Nick


  reply	other threads:[~2010-08-26  9:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25 19:28 [PATCH] lglock: make lg_lock_global() actually lock globally Jonathan Corbet
2010-08-25 20:00 ` Linus Torvalds
2010-08-25 20:16   ` Jonathan Corbet
2010-08-26  4:23     ` Nick Piggin
2010-08-26  8:55   ` Tejun Heo
2010-08-26  9:46     ` Nick Piggin [this message]
2010-08-26  9:49       ` Tejun Heo
2010-08-26  9:50         ` Tejun Heo
2010-08-26 10:08         ` Peter Zijlstra
2010-08-26 11:38           ` Nick Piggin
2010-08-26 11:45             ` Peter Zijlstra
2010-08-26 11:49               ` Peter Zijlstra
2010-08-27  5:51               ` Nick Piggin
2010-08-27  7:57                 ` Peter Zijlstra
2010-08-27  7:59                   ` Peter Zijlstra
2010-08-26 10:08       ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2010-09-08 22:54 Jonathan Corbet

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=20100826094613.GA6411@amd \
    --to=npiggin@kernel.dk \
    --cc=a.p.zijlstra@chello.nl \
    --cc=corbet@lwn.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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