diff options
author | Christoph Hellwig <hch@lst.de> | 2016-11-08 20:15:02 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-11-09 02:25:08 -0500 |
commit | 212bd846223c718b6577d4df16fd8d05a55ad914 (patch) | |
tree | 3dec4e4929b02753ffba2018ea8849eb8cd29f11 /kernel/irq/affinity.c | |
parent | 20e407e195b29a4f5a18d713a61f54a75f992bd5 (diff) |
genirq/affinity: Handle pre/post vectors in irq_calc_affinity_vectors()
Only calculate the affinity for the main I/O vectors, and skip the pre or
post vectors specified by struct irq_affinity.
Also remove the irq_affinity cpumask argument that has never been used. If
we ever need it in the future we can pass it through struct irq_affinity.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Link: http://lkml.kernel.org/r/1478654107-7384-3-git-send-email-hch@lst.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq/affinity.c')
-rw-r--r-- | kernel/irq/affinity.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c index 17f51d63da56..8d9259727cb4 100644 --- a/kernel/irq/affinity.c +++ b/kernel/irq/affinity.c | |||
@@ -131,24 +131,20 @@ out: | |||
131 | } | 131 | } |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * irq_calc_affinity_vectors - Calculate to optimal number of vectors for a given affinity mask | 134 | * irq_calc_affinity_vectors - Calculate the optimal number of vectors |
135 | * @affinity: The affinity mask to spread. If NULL cpu_online_mask | 135 | * @maxvec: The maximum number of vectors available |
136 | * is used | 136 | * @affd: Description of the affinity requirements |
137 | * @maxvec: The maximum number of vectors available | ||
138 | */ | 137 | */ |
139 | int irq_calc_affinity_vectors(const struct cpumask *affinity, int maxvec) | 138 | int irq_calc_affinity_vectors(int maxvec, const struct irq_affinity *affd) |
140 | { | 139 | { |
141 | int cpus, ret; | 140 | int resv = affd->pre_vectors + affd->post_vectors; |
141 | int vecs = maxvec - resv; | ||
142 | int cpus; | ||
142 | 143 | ||
143 | /* Stabilize the cpumasks */ | 144 | /* Stabilize the cpumasks */ |
144 | get_online_cpus(); | 145 | get_online_cpus(); |
145 | /* If the supplied affinity mask is NULL, use cpu online mask */ | 146 | cpus = cpumask_weight(cpu_online_mask); |
146 | if (!affinity) | ||
147 | affinity = cpu_online_mask; | ||
148 | |||
149 | cpus = cpumask_weight(affinity); | ||
150 | ret = (cpus < maxvec) ? cpus : maxvec; | ||
151 | |||
152 | put_online_cpus(); | 147 | put_online_cpus(); |
153 | return ret; | 148 | |
149 | return min(cpus, vecs) + resv; | ||
154 | } | 150 | } |