Setting CPU affinity for current process on kernel module?

Bharath Vedartham linux.bhar at gmail.com
Thu Sep 12 05:26:18 EDT 2019


On Wed, Sep 11, 2019 at 04:19:41PM -0300, Martin Galvan wrote:
> El mié., 11 sept. 2019 a las 16:17, Bharath Vedartham
> (<linux.bhar at gmail.com>) escribió:
> > So one thing that pops to my head is using cgroups. Create a cgroup,
> > modify the cpu file in cpusets cgroup and add the required task to it.
> > But I am not sure whether you can do all of this from a kernel module...
> 
> Thanks, but that's not feasible. This should all be done
> programmatically from the module, and be as minimally invasive as
> possible.
Just to be clear, What do you mean by current process. Is it the process
which is executing the kernel module? That would be a kernel thread I
believe or do you want to be able to set the cpu affinity for any
process given its PID? 
And are you looking at setting CPU affinity of kernel threads or user
threads. 

Thank you
Bharath



More information about the Kernelnewbies mailing list