Lines Matching refs:cpumask

7 #include <linux/cpumask.h>
10 * struct bpf_cpumask - refcounted BPF cpumask wrapper structure
11 * @cpumask: The actual cpumask embedded in the struct.
19 * the details in <linux/cpumask.h>. The consequence is that this structure is
26 cpumask_t cpumask;
40 * bpf_cpumask_create() - Create a mutable BPF cpumask.
42 * Allocates a cpumask that can be queried, mutated, acquired, and released by
43 * a BPF program. The cpumask returned by this function must either be embedded
51 struct bpf_cpumask *cpumask;
53 /* cpumask must be the first element so struct bpf_cpumask be cast to struct cpumask. */
54 BUILD_BUG_ON(offsetof(struct bpf_cpumask, cpumask) != 0);
56 cpumask = bpf_mem_cache_alloc(&bpf_cpumask_ma);
57 if (!cpumask)
60 memset(cpumask, 0, sizeof(*cpumask));
61 refcount_set(&cpumask->usage, 1);
63 return cpumask;
67 * bpf_cpumask_acquire() - Acquire a reference to a BPF cpumask.
68 * @cpumask: The BPF cpumask being acquired. The cpumask must be a trusted
71 * Acquires a reference to a BPF cpumask. The cpumask returned by this function
75 __bpf_kfunc struct bpf_cpumask *bpf_cpumask_acquire(struct bpf_cpumask *cpumask)
77 refcount_inc(&cpumask->usage);
78 return cpumask;
82 * bpf_cpumask_release() - Release a previously acquired BPF cpumask.
83 * @cpumask: The cpumask being released.
85 * Releases a previously acquired reference to a BPF cpumask. When the final
86 * reference of the BPF cpumask has been released, it is subsequently freed in
89 __bpf_kfunc void bpf_cpumask_release(struct bpf_cpumask *cpumask)
91 if (!refcount_dec_and_test(&cpumask->usage))
95 bpf_mem_cache_free_rcu(&bpf_cpumask_ma, cpumask);
99 __bpf_kfunc void bpf_cpumask_release_dtor(void *cpumask)
101 bpf_cpumask_release(cpumask);
106 * bpf_cpumask_first() - Get the index of the first nonzero bit in the cpumask.
107 * @cpumask: The cpumask being queried.
109 * Find the index of the first nonzero bit of the cpumask. A struct bpf_cpumask
112 __bpf_kfunc u32 bpf_cpumask_first(const struct cpumask *cpumask)
114 return cpumask_first(cpumask);
119 * cpumask.
120 * @cpumask: The cpumask being queried.
122 * Find the index of the first unset bit of the cpumask. A struct bpf_cpumask
125 __bpf_kfunc u32 bpf_cpumask_first_zero(const struct cpumask *cpumask)
127 return cpumask_first_zero(cpumask);
133 * @src1: The first cpumask.
134 * @src2: The second cpumask.
139 __bpf_kfunc u32 bpf_cpumask_first_and(const struct cpumask *src1,
140 const struct cpumask *src2)
146 * bpf_cpumask_set_cpu() - Set a bit for a CPU in a BPF cpumask.
147 * @cpu: The CPU to be set in the cpumask.
148 * @cpumask: The BPF cpumask in which a bit is being set.
150 __bpf_kfunc void bpf_cpumask_set_cpu(u32 cpu, struct bpf_cpumask *cpumask)
155 cpumask_set_cpu(cpu, (struct cpumask *)cpumask);
159 * bpf_cpumask_clear_cpu() - Clear a bit for a CPU in a BPF cpumask.
160 * @cpu: The CPU to be cleared from the cpumask.
161 * @cpumask: The BPF cpumask in which a bit is being cleared.
163 __bpf_kfunc void bpf_cpumask_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask)
168 cpumask_clear_cpu(cpu, (struct cpumask *)cpumask);
172 * bpf_cpumask_test_cpu() - Test whether a CPU is set in a cpumask.
174 * @cpumask: The cpumask being queried for containing a CPU.
177 * * true - @cpu is set in the cpumask
178 * * false - @cpu was not set in the cpumask, or @cpu is an invalid cpu.
180 __bpf_kfunc bool bpf_cpumask_test_cpu(u32 cpu, const struct cpumask *cpumask)
185 return cpumask_test_cpu(cpu, (struct cpumask *)cpumask);
189 * bpf_cpumask_test_and_set_cpu() - Atomically test and set a CPU in a BPF cpumask.
191 * @cpumask: The BPF cpumask being set and queried for containing a CPU.
194 * * true - @cpu is set in the cpumask
195 * * false - @cpu was not set in the cpumask, or @cpu is invalid.
197 __bpf_kfunc bool bpf_cpumask_test_and_set_cpu(u32 cpu, struct bpf_cpumask *cpumask)
202 return cpumask_test_and_set_cpu(cpu, (struct cpumask *)cpumask);
207 * cpumask.
209 * @cpumask: The BPF cpumask being cleared and queried for containing a CPU.
212 * * true - @cpu is set in the cpumask
213 * * false - @cpu was not set in the cpumask, or @cpu is invalid.
215 __bpf_kfunc bool bpf_cpumask_test_and_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask)
220 return cpumask_test_and_clear_cpu(cpu, (struct cpumask *)cpumask);
224 * bpf_cpumask_setall() - Set all of the bits in a BPF cpumask.
225 * @cpumask: The BPF cpumask having all of its bits set.
227 __bpf_kfunc void bpf_cpumask_setall(struct bpf_cpumask *cpumask)
229 cpumask_setall((struct cpumask *)cpumask);
233 * bpf_cpumask_clear() - Clear all of the bits in a BPF cpumask.
234 * @cpumask: The BPF cpumask being cleared.
236 __bpf_kfunc void bpf_cpumask_clear(struct bpf_cpumask *cpumask)
238 cpumask_clear((struct cpumask *)cpumask);
243 * @dst: The BPF cpumask where the result is being stored.
254 const struct cpumask *src1,
255 const struct cpumask *src2)
257 return cpumask_and((struct cpumask *)dst, src1, src2);
262 * @dst: The BPF cpumask where the result is being stored.
269 const struct cpumask *src1,
270 const struct cpumask *src2)
272 cpumask_or((struct cpumask *)dst, src1, src2);
277 * @dst: The BPF cpumask where the result is being stored.
284 const struct cpumask *src1,
285 const struct cpumask *src2)
287 cpumask_xor((struct cpumask *)dst, src1, src2);
301 __bpf_kfunc bool bpf_cpumask_equal(const struct cpumask *src1, const struct cpumask *src2)
317 __bpf_kfunc bool bpf_cpumask_intersects(const struct cpumask *src1, const struct cpumask *src2)
323 * bpf_cpumask_subset() - Check if a cpumask is a subset of another.
324 * @src1: The first cpumask being checked as a subset.
325 * @src2: The second cpumask being checked as a superset.
333 __bpf_kfunc bool bpf_cpumask_subset(const struct cpumask *src1, const struct cpumask *src2)
339 * bpf_cpumask_empty() - Check if a cpumask is empty.
340 * @cpumask: The cpumask being checked.
343 * * true - None of the bits in @cpumask are set.
344 * * false - At least one bit in @cpumask is set.
346 * A struct bpf_cpumask pointer may be safely passed to @cpumask.
348 __bpf_kfunc bool bpf_cpumask_empty(const struct cpumask *cpumask)
350 return cpumask_empty(cpumask);
354 * bpf_cpumask_full() - Check if a cpumask has all bits set.
355 * @cpumask: The cpumask being checked.
358 * * true - All of the bits in @cpumask are set.
359 * * false - At least one bit in @cpumask is cleared.
361 * A struct bpf_cpumask pointer may be safely passed to @cpumask.
363 __bpf_kfunc bool bpf_cpumask_full(const struct cpumask *cpumask)
365 return cpumask_full(cpumask);
369 * bpf_cpumask_copy() - Copy the contents of a cpumask into a BPF cpumask.
370 * @dst: The BPF cpumask being copied into.
371 * @src: The cpumask being copied.
375 __bpf_kfunc void bpf_cpumask_copy(struct bpf_cpumask *dst, const struct cpumask *src)
377 cpumask_copy((struct cpumask *)dst, src);
381 * bpf_cpumask_any_distribute() - Return a random set CPU from a cpumask.
382 * @cpumask: The cpumask being queried.
390 __bpf_kfunc u32 bpf_cpumask_any_distribute(const struct cpumask *cpumask)
392 return cpumask_any_distribute(cpumask);
398 * @src1: The first cpumask.
399 * @src2: The second cpumask.
408 __bpf_kfunc u32 bpf_cpumask_any_and_distribute(const struct cpumask *src1,
409 const struct cpumask *src2)
415 * bpf_cpumask_weight() - Return the number of bits in @cpumask.
416 * @cpumask: The cpumask being queried.
418 * Count the number of set bits in the given cpumask.
420 __bpf_kfunc u32 bpf_cpumask_weight(const struct cpumask *cpumask)
422 return cpumask_weight(cpumask);