Search code examples
linux-kernelbpfebpf

Use eBPF to change process's CPU affinity


Is it possible to change a process's CPU affinity with eBPF? I checked all bpf helper functions, no directly related functions. But can use bpf_get_current_task to retrieve the task_struct. Is it possible to change a process's CPU affinity via modifying its task_struct in eBPF?


Solution

  • No, it is not. The object you get as a pointer from bpf_get_current_task is read-only. And I don't know of any other way to change the CPU affinity with BPF today.