Index: sys/kern/kern_kthread.c =================================================================== --- sys/kern/kern_kthread.c (revision 230641) +++ sys/kern/kern_kthread.c (working copy) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -117,6 +118,9 @@ kproc_create(void (*func)(void *), void *arg, /* call the processes' main()... */ cpu_set_fork_handler(td, func, arg); + + /* Avoid inheriting affinity from a random parent. */ + cpuset_setthread(td->td_tid, cpuset_root); thread_lock(td); TD_SET_CAN_RUN(td); sched_prio(td, PVM); @@ -299,6 +303,9 @@ kthread_add(void (*func)(void *), void *arg, struc tidhash_add(newtd); + /* Avoid inheriting affinity from a random parent. */ + cpuset_setthread(newtd->td_tid, cpuset_root); + /* Delay putting it on the run queue until now. */ if (!(flags & RFSTOPPED)) { thread_lock(newtd);