mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Prarit Bhargava <prarit@redhat.com>,
	Yinghai Lu <yinghai@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	David Rientjes <rientjes@google.com>
Subject: [PATCH] Use NUMA node cpu mask in irq affinity [v3]
Date: Mon, 26 Mar 2012 15:02:18 -0400	[thread overview]
Message-ID: <1332788538-17425-1-git-send-email-prarit@redhat.com> (raw)

[Resending ... Seems to have died on the vine here
http://marc.info/?l=linux-kernel&m=132914231706596&q=raw ]

The irq affinity files (/proc/irq/.../smp_affinity) contain a mask that is
used to "pin" an irq to a set of cpus.  On boot this set is currently all
cpus.  This can be incorrect as ACPI SRAT may tell us that a specific
device or bus is attached to a particular node and it's cpus.

When setting up the irq affinity we should take into account the NUMA node
cpu mask by and'ing it into the irq's affinity mask.

[v2]: Thomas and Yinghai pointed out that it is possible that the mask is
empty after and'ing in the NUMA node's cpumask.  The code now checks to see
if the mask will be empty before applying the NUMA node's cpumask.

[v3]: David requests NUMA_NO_NODE instead of -1

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: David Rientjes <rientjes@google.com>
---
 kernel/irq/manage.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index b0ccd1a..96a18f1 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -301,6 +301,13 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask)
 	}
 
 	cpumask_and(mask, cpu_online_mask, set);
+	if (desc->irq_data.node != NUMA_NO_NODE) {
+		const struct cpumask *nodemask =
+					   cpumask_of_node(desc->irq_data.node);
+		/* make sure at least one of the cpus in nodemask is online */
+		if (cpumask_intersects(mask, nodemask))
+			cpumask_and(mask, mask, nodemask);
+	}
 	ret = chip->irq_set_affinity(&desc->irq_data, mask, false);
 	switch (ret) {
 	case IRQ_SET_MASK_OK:
-- 
1.7.1


             reply	other threads:[~2012-03-26 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 19:02 Prarit Bhargava [this message]
2012-03-29  9:54 ` [tip:irq/core] genirq: Respect NUMA node affinity in setup_irq_irq affinity() tip-bot for Prarit Bhargava
  -- strict thread matches above, loose matches on Subject: below --
2012-02-13 14:11 [PATCH] Use NUMA node cpu mask in irq affinity [v3] Prarit Bhargava

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=1332788538-17425-1-git-send-email-prarit@redhat.com \
    --to=prarit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=tglx@linutronix.de \
    --cc=yinghai@kernel.org \
    /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

Powered by JetHome