Setting CPU affinity for current process on kernel module?

Martin Galvan omgalvan.86 at gmail.com
Thu Sep 12 10:03:20 EDT 2019


El jue., 12 sept. 2019 a las 6:26, Bharath Vedartham
(<linux.bhar at gmail.com>) escribió:
> 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.

Sorry, I wasn't clear: I want to set the affinity of 'current', which
is a kernel thread.

El jue., 12 sept. 2019 a las 6:38, Piotr Figiel (<figiel at gmail.com>) escribió:
> set_cpus_allowed_ptr() is exported, maybe this is what you're looking for?

Yes, that's exactly what I needed. Thanks! I actually ended up using
work_on_cpu, which fits my use case better.



More information about the Kernelnewbies mailing list