mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: linux-kernel@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>
Subject: get/put_online_cpus documentation wrong?
Date: Tue, 1 May 2012 10:12:38 +1000	[thread overview]
Message-ID: <20120501001238.GA15497@bloggs.ozlabs.ibm.com> (raw)

In Documentation/cpu-hotplug.txt it says:

"	#include <linux/cpu.h>
	get_online_cpus() and put_online_cpus():

The above calls are used to inhibit cpu hotplug operations. While the
cpu_hotplug.refcount is non zero, the cpu_online_mask will not change.
If you merely need to avoid cpus going away, you could also use
preempt_disable() and preempt_enable() for those sections.
Just remember the critical section cannot call any
function that can sleep or schedule this process away."

That last statement doesn't seem like it can be correct, given that
get_online_cpus and put_online_cpus both do a mutex_lock(), which can
sleep.  So, is that statement still correct?  What would happen if a
process did sleep after doing get_online_cpus()?

Also, get/put_online_cpus doing mutex_lock() implies that one should
not call them in atomic context, e.g. while holding a spinlock, which
could usefully be mentioned in cpu-hotplug.txt.

I'm happy to do a patch to update cpu-hotplug.txt once it's clear what
the actual constraints are.

Paul.

             reply	other threads:[~2012-05-01  0:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01  0:12 Paul Mackerras [this message]
2012-05-01 11:26 ` Gilad Ben-Yossef
2012-05-01 13:58   ` Srivatsa S. Bhat

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=20120501001238.GA15497@bloggs.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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

all inboxes | Powered by JetHome®