Lines Matching refs:cpumask

6 BPF cpumask kfuncs
12 ``struct cpumask`` is a bitmap data structure in the kernel whose indices
21 2. BPF cpumask objects
29 ``struct bpf_cpumask *`` is a cpumask that is allocated by BPF, on behalf of a
32 to a ``struct cpumask *``.
40 .. kernel-doc:: kernel/bpf/cpumask.c
43 .. kernel-doc:: kernel/bpf/cpumask.c
46 .. kernel-doc:: kernel/bpf/cpumask.c
54 struct bpf_cpumask __kptr * cpumask;
71 local.cpumask = NULL;
84 old = bpf_kptr_xchg(&v->cpumask, mask);
92 * A sample tracepoint showing how a task's cpumask can be queried and
98 struct bpf_cpumask *cpumask;
101 cpumask = bpf_cpumask_create();
102 if (!cpumask)
108 bpf_cpumask_copy(cpumask, task->cpus_ptr);
109 return cpumask_map_insert(cpumask, task->pid);
158 kptr = v->cpumask;
177 2.2 ``struct cpumask``
180 ``struct cpumask`` is the object that actually contains the cpumask bitmap
182 cpumask``, which is why it's safe to cast it as such (note however that it is
183 **not** safe to cast a ``struct cpumask *`` to a ``struct bpf_cpumask *``, and
186 As we'll see below, any kfunc that mutates its cpumask argument will take a
188 cpumask will instead take a ``struct cpumask *``.
190 3. cpumask kfuncs
200 Some cpumask kfuncs are "read-only" in that they don't mutate any of their
204 This section will describe all of the cpumask kfuncs which mutate at least one
213 .. kernel-doc:: kernel/bpf/cpumask.c
222 * A sample tracepoint showing how a cpumask can be queried.
227 struct bpf_cpumask *cpumask;
229 cpumask = bpf_cpumask_create();
230 if (!cpumask)
233 bpf_cpumask_set_cpu(0, cpumask);
234 if (!bpf_cpumask_test_cpu(0, cast(cpumask)))
238 bpf_cpumask_clear_cpu(0, cpumask);
239 if (bpf_cpumask_test_cpu(0, cast(cpumask)))
243 /* struct cpumask * pointers such as task->cpus_ptr can also be queried. */
248 bpf_cpumask_release(cpumask);
258 .. kernel-doc:: kernel/bpf/cpumask.c
266 .. kernel-doc:: kernel/bpf/cpumask.c
272 In addition to setting and clearing individual CPUs in a single cpumask,
276 .. kernel-doc:: kernel/bpf/cpumask.c
285 * A sample tracepoint showing how a cpumask can be mutated using
307 bpf_cpumask_and(dst1, (const struct cpumask *)mask1, (const struct cpumask *)mask2);
308 if (!bpf_cpumask_empty((const struct cpumask *)dst1))
312 bpf_cpumask_or(dst1, (const struct cpumask *)mask1, (const struct cpumask *)mask2);
313 if (!bpf_cpumask_test_cpu(0, (const struct cpumask *)dst1))
317 if (!bpf_cpumask_test_cpu(1, (const struct cpumask *)dst1))
321 bpf_cpumask_xor(dst2, (const struct cpumask *)mask1, (const struct cpumask *)mask2);
322 if (!bpf_cpumask_equal((const struct cpumask *)dst1,
323 (const struct cpumask *)dst2))
337 The contents of an entire cpumask may be copied to another using
340 .. kernel-doc:: kernel/bpf/cpumask.c
353 .. kernel-doc:: kernel/bpf/cpumask.c
357 .. kernel-doc:: kernel/bpf/cpumask.c
361 .. kernel-doc:: kernel/bpf/cpumask.c
376 4. Adding BPF cpumask kfuncs
379 The set of supported BPF cpumask kfuncs are not (yet) a 1-1 match with the
380 cpumask operations in include/linux/cpumask.h. Any of those cpumask operations
382 to support a new cpumask operation, please feel free to submit a patch. If you
383 do add a new cpumask kfunc, please document it here, and add any relevant
384 selftest testcases to the cpumask selftest suite.