aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cpumask.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-06-02 00:58:02 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-02 00:58:02 -0400
commitee39facbf82e73e468c504d2b40e83e2d223c28c (patch)
tree802451ae11344f94f66a8b922a5418095707517e /lib/cpumask.c
parent2a82e40d6b66373498bf937e31b249f17dc1105a (diff)
net: Revert mlx4 cpumask changes.
This reverts commit 70a640d0dae3a9b1b222ce673eb5d92c263ddd61 ("net/mlx4_en: Use affinity hint") and commit c8865b64b05b2f4eeefd369373e9c8aeb069e7a1 ("cpumask: Utility function to set n'th cpu - local cpu first") because these changes break the build when SMP is disabled amongst other things. Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/cpumask.c')
-rw-r--r--lib/cpumask.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 14049a96f04a..b810b753c607 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -163,68 +163,4 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask)
163{ 163{
164 memblock_free_early(__pa(mask), cpumask_size()); 164 memblock_free_early(__pa(mask), cpumask_size());
165} 165}
166
167/**
168 * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first
169 *
170 * @i: index number
171 * @numa_node: local numa_node
172 * @dstp: cpumask with the relevant cpu bit set according to the policy
173 *
174 * This function sets the cpumask according to a numa aware policy.
175 * cpumask could be used as an affinity hint for the IRQ related to a
176 * queue. When the policy is to spread queues across cores - local cores
177 * first.
178 *
179 * Returns 0 on success, -ENOMEM for no memory, and -EAGAIN when failed to set
180 * the cpu bit and need to re-call the function.
181 */
182int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
183{
184 cpumask_var_t mask;
185 int cpu;
186 int ret = 0;
187
188 if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
189 return -ENOMEM;
190
191 i %= num_online_cpus();
192
193 if (!cpumask_of_node(numa_node)) {
194 /* Use all online cpu's for non numa aware system */
195 cpumask_copy(mask, cpu_online_mask);
196 } else {
197 int n;
198
199 cpumask_and(mask,
200 cpumask_of_node(numa_node), cpu_online_mask);
201
202 n = cpumask_weight(mask);
203 if (i >= n) {
204 i -= n;
205
206 /* If index > number of local cpu's, mask out local
207 * cpu's
208 */
209 cpumask_andnot(mask, cpu_online_mask, mask);
210 }
211 }
212
213 for_each_cpu(cpu, mask) {
214 if (--i < 0)
215 goto out;
216 }
217
218 ret = -EAGAIN;
219
220out:
221 free_cpumask_var(mask);
222
223 if (!ret)
224 cpumask_set_cpu(cpu, dstp);
225
226 return ret;
227}
228EXPORT_SYMBOL(cpumask_set_cpu_local_first);
229
230#endif 166#endif