LKML Archive on
 help / color / Atom feed
From: Christoph Hellwig <>
Subject: [PATCH for-4.8] irq/affinity: use get/put_online_cpus
Date: Thu, 11 Aug 2016 07:06:45 -0700
Message-ID: <> (raw)

Without locking out CPU mask operations we might end up with an inconsistent
view of the cpumask in the function.

Signed-off-by: Christoph Hellwig <>
 kernel/irq/affinity.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index f689593..32f6cfc 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -39,6 +39,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
 		return NULL;
+	get_online_cpus();
 	if (max_vecs >= num_online_cpus()) {
 		cpumask_copy(affinity_mask, cpu_online_mask);
 		*nr_vecs = num_online_cpus();
@@ -56,6 +57,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
 		*nr_vecs = vecs;
+	put_online_cpus();
 	return affinity_mask;

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 14:06 Christoph Hellwig [this message]
2016-08-14 16:00 ` Christoph Hellwig
2016-08-22  9:01   ` Thomas Gleixner
2016-08-22  9:28 ` [tip:irq/urgent] genirq/affinity: Use get/put_online_cpus around cpumask operations tip-bot for Christoph Hellwig

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:

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

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone