How to bind a thread to a CPU?

Neel Natu neelnatu at gmail.com
Sun Jun 14 17:02:10 UTC 2015


Hi Stefan,

> On Jun 13, 2015, at 12:12 PM, Stefan Andritoiu <stefan.andritoiu at gmail.com> wrote:
> 
> Hi Neel,
> 
>> On Sat, Jun 13, 2015 at 9:00 PM, Neel Natu <neelnatu at gmail.com> wrote:
>> Hi Stefan,
>> 
>> On Sat, Jun 13, 2015 at 3:33 AM, Stefan Andritoiu
>> <stefan.andritoiu at gmail.com> wrote:
>>> Hi,
>>> 
>>> How can I pin a thread to run only on a specific CPU?
>>> Is it enough just to set the "struct cpuset *td_cpuset" of the thread?
>> 
>> sched_bind() is the proper way to do this.
> 
> But in sched_bind() I notice:
>  KASSERT(td == curthread, ("sched_bind: can only bind curthread"));
> 
> How can I bind a thread that is not curthread?

I don't know offhand but your original suggestion of 'td_cpuset' does seem like a reasonable place to start.

Best
Neel

> 
>> 
>> best
>> Neel
>> 
>>> Thank you,
>>> Stefan
>>> _______________________________________________
>>> freebsd-virtualization at freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>>> To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe at freebsd.org"


More information about the freebsd-virtualization mailing list