diff options
Diffstat (limited to 'kernel/irq/affinity.c')
-rw-r--r-- | kernel/irq/affinity.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c index e2d356dd7581..9b71406d2eec 100644 --- a/kernel/irq/affinity.c +++ b/kernel/irq/affinity.c | |||
@@ -66,6 +66,13 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) | |||
66 | struct cpumask *masks; | 66 | struct cpumask *masks; |
67 | cpumask_var_t nmsk; | 67 | cpumask_var_t nmsk; |
68 | 68 | ||
69 | /* | ||
70 | * If there aren't any vectors left after applying the pre/post | ||
71 | * vectors don't bother with assigning affinity. | ||
72 | */ | ||
73 | if (!affv) | ||
74 | return NULL; | ||
75 | |||
69 | if (!zalloc_cpumask_var(&nmsk, GFP_KERNEL)) | 76 | if (!zalloc_cpumask_var(&nmsk, GFP_KERNEL)) |
70 | return NULL; | 77 | return NULL; |
71 | 78 | ||
@@ -140,15 +147,19 @@ out: | |||
140 | 147 | ||
141 | /** | 148 | /** |
142 | * irq_calc_affinity_vectors - Calculate the optimal number of vectors | 149 | * irq_calc_affinity_vectors - Calculate the optimal number of vectors |
150 | * @minvec: The minimum number of vectors available | ||
143 | * @maxvec: The maximum number of vectors available | 151 | * @maxvec: The maximum number of vectors available |
144 | * @affd: Description of the affinity requirements | 152 | * @affd: Description of the affinity requirements |
145 | */ | 153 | */ |
146 | int irq_calc_affinity_vectors(int maxvec, const struct irq_affinity *affd) | 154 | int irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd) |
147 | { | 155 | { |
148 | int resv = affd->pre_vectors + affd->post_vectors; | 156 | int resv = affd->pre_vectors + affd->post_vectors; |
149 | int vecs = maxvec - resv; | 157 | int vecs = maxvec - resv; |
150 | int cpus; | 158 | int cpus; |
151 | 159 | ||
160 | if (resv > minvec) | ||
161 | return 0; | ||
162 | |||
152 | /* Stabilize the cpumasks */ | 163 | /* Stabilize the cpumasks */ |
153 | get_online_cpus(); | 164 | get_online_cpus(); |
154 | cpus = cpumask_weight(cpu_online_mask); | 165 | cpus = cpumask_weight(cpu_online_mask); |