svn commit: r232756 - stable/9/sys/kern
Ryan Stone
rstone at FreeBSD.org
Sat Mar 10 02:26:13 UTC 2012
Author: rstone
Date: Sat Mar 10 02:26:12 2012
New Revision: 232756
URL: http://svn.freebsd.org/changeset/base/232756
Log:
MFC r230984:
Whenever a new kernel thread is spawned, explicitly clear any CPU affinity
set on the new thread. This prevents the thread from inadvertently
inheriting affinity from a random sibling.
Modified:
stable/9/sys/kern/kern_kthread.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/kern/kern_kthread.c
==============================================================================
--- stable/9/sys/kern/kern_kthread.c Sat Mar 10 01:36:42 2012 (r232755)
+++ stable/9/sys/kern/kern_kthread.c Sat Mar 10 02:26:12 2012 (r232756)
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/cpuset.h>
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/mutex.h>
@@ -117,6 +118,9 @@ kproc_create(void (*func)(void *), void
/* 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 *
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);
More information about the svn-src-stable-9
mailing list