All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Gautham R Shenoy <ego@in.ibm.com>
Cc: rusty@rustcorp.com.au, torvalds@osdl.org, akpm@osdl.org,
	linux-kernel@vger.kernel.org, arjan@intel.linux.com,
	davej@redhat.com, vatsa@in.ibm.com, dipankar@in.ibm.com,
	ashok.raj@intel.com
Subject: Re: [RFC][PATCH 3/4] (Refcount + Waitqueue) implementation for cpu_hotplug "locking"
Date: Thu, 24 Aug 2006 13:14:40 +0200	[thread overview]
Message-ID: <20060824111440.GA19248@elte.hu> (raw)
In-Reply-To: <20060824103233.GD2395@in.ibm.com>


* Gautham R Shenoy <ego@in.ibm.com> wrote:

>  void lock_cpu_hotplug(void)
>  {

> +	DECLARE_WAITQUEUE(wait, current);
> +	spin_lock(&cpu_hotplug.lock);
> +	cpu_hotplug.reader_count++;

this should be per-CPU - lock_cpu_hotplug() should _not_ be a globally 
synchronized event.

CPU removal is such a rare event that we can easily do something like a 
global read-mostly 'CPU is locked for writes' flag (plus a completion 
queue) that the 'write' side takes atomically - combined with per-CPU 
refcount and a waitqueue that the read side increases/decreases and 
wakes. Read-locking of the CPU is much more common and should be 
fundamentally scalable: it should increase the per-CPU refcount, then 
check the global 'writer active' flag, and if the writer flag is set, it 
should wait on the global completion queue. When a reader drops the 
refcount it should wake up the per-CPU waitqueue. [in which a writer 
might be waiting for the refcount to go down to 0.]

	Ingo

  reply	other threads:[~2006-08-24 11:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-24 10:32 [RFC][PATCH 3/4] (Refcount + Waitqueue) implementation for cpu_hotplug "locking" Gautham R Shenoy
2006-08-24 11:14 ` Ingo Molnar [this message]
2006-08-24 12:28   ` Gautham R Shenoy
2006-08-24 12:25     ` Ingo Molnar
2006-08-24 12:58       ` Srivatsa Vaddagiri
2006-08-25  6:04         ` Gautham R Shenoy
2006-08-25  6:19           ` Nick Piggin
2006-08-25  6:29             ` Srivatsa Vaddagiri

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=20060824111440.GA19248@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=arjan@intel.linux.com \
    --cc=ashok.raj@intel.com \
    --cc=davej@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@osdl.org \
    --cc=vatsa@in.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.