aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cpumask.h
diff options
context:
space:
mode:
authorAmir Vadai <amirv@mellanox.com>2014-06-09 03:24:38 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-11 17:58:16 -0400
commitda91309e0a7e8966d916a74cce42ed170fde06bf (patch)
tree71bb5b4da988abb97d1a696c2f64bf39ecf9ae0d /include/linux/cpumask.h
parentd4f3862017f9aaa1a6b6bade396a99a4b77e2cb2 (diff)
cpumask: Utility function to set n'th cpu - local cpu first
This function sets the n'th cpu - local cpu's first. For example: in a 16 cores server with even cpu's local, will get the following values: cpumask_set_cpu_local_first(0, numa, cpumask) => cpu 0 is set cpumask_set_cpu_local_first(1, numa, cpumask) => cpu 2 is set ... cpumask_set_cpu_local_first(7, numa, cpumask) => cpu 14 is set cpumask_set_cpu_local_first(8, numa, cpumask) => cpu 1 is set cpumask_set_cpu_local_first(9, numa, cpumask) => cpu 3 is set ... cpumask_set_cpu_local_first(15, numa, cpumask) => cpu 15 is set Curently this function will be used by multi queue networking devices to calculate the irq affinity mask, such that as many local cpu's as possible will be utilized to handle the mq device irq's. Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/cpumask.h')
-rw-r--r--include/linux/cpumask.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d08e4d2a9b92..d5ef249735d2 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -142,6 +142,13 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask,
142 return 1; 142 return 1;
143} 143}
144 144
145static inline int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
146{
147 set_bit(0, cpumask_bits(dstp));
148
149 return 0;
150}
151
145#define for_each_cpu(cpu, mask) \ 152#define for_each_cpu(cpu, mask) \
146 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 153 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
147#define for_each_cpu_not(cpu, mask) \ 154#define for_each_cpu_not(cpu, mask) \
@@ -192,6 +199,7 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp)
192 199
193int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); 200int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);
194int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); 201int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
202int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
195 203
196/** 204/**
197 * for_each_cpu - iterate over every cpu in a mask 205 * for_each_cpu - iterate over every cpu in a mask