public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86/irq: optimizing nr_irqs -v2
Date: Sun, 08 Feb 2009 01:44:04 -0800	[thread overview]
Message-ID: <498EA964.2070902@kernel.org> (raw)
In-Reply-To: <498CCF28.3050207@kernel.org>


Impact: more depend on cards to be used

depend on nr_irq_gsi more, and have a ratio for MSI

v2: make nr_irqs shoule less than NR_VECTORS * nr_cpu_ids
   aka if only one cpu, we only can support nr_irqs = NR_VECTORS

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/io_apic.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -3482,9 +3482,9 @@ int arch_setup_msi_irqs(struct pci_dev *
 	sub_handle = 0;
 	list_for_each_entry(msidesc, &dev->msi_list, list) {
 		irq = create_irq_nr(irq_want);
-		irq_want++;
 		if (irq == 0)
 			return -1;
+		irq_want = irq + 1;
 #ifdef CONFIG_INTR_REMAP
 		if (!intr_remapping_enabled)
 			goto no_ir;
@@ -3838,11 +3838,17 @@ int __init arch_probe_nr_irqs(void)
 {
 	int nr;
 
-	nr = ((8 * nr_cpu_ids) > (32 * nr_ioapics) ?
-		(NR_VECTORS + (8 * nr_cpu_ids)) :
-		(NR_VECTORS + (32 * nr_ioapics)));
+	if (nr_irqs > (NR_VECTORS * nr_cpu_ids))
+		nr_irqs = NR_VECTORS * nr_cpu_ids;
 
-	if (nr < nr_irqs && nr > nr_irqs_gsi)
+	nr = nr_irqs_gsi + 8 * nr_cpu_ids;
+#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
+	/*
+	 * for MSI and HT dyn irq
+	 */
+	nr += nr_irqs_gsi * 16;
+#endif
+	if (nr < nr_irqs)
 		nr_irqs = nr;
 
 	return 0;

  reply	other threads:[~2009-02-08  9:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-06 23:59 [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Yinghai Lu
2009-02-07  0:00 ` [PATCH] x86/irq: optimizing nr_irqs Yinghai Lu
2009-02-08  9:44   ` Yinghai Lu [this message]
2009-02-09  8:14     ` [PATCH] x86/irq: optimizing nr_irqs -v2 Ingo Molnar
2009-02-07  3:35 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Len Brown
2009-02-07  3:47   ` Yinghai Lu
2009-02-07  7:15     ` Len Brown
2009-02-08  1:13 ` [PATCH] x86: use NR_IRQS_LEGACY to replace 16 Yinghai Lu
2009-02-09  8:14   ` Ingo Molnar
2009-02-09  8:13 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Ingo Molnar
2009-02-09  9:03   ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing v3 Yinghai Lu

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=498EA964.2070902@kernel.org \
    --to=yinghai@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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