From owner-svn-src-stable@FreeBSD.ORG Sat Mar 10 02:27:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10A09106567B; Sat, 10 Mar 2012 02:27:05 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED05E8FC1A; Sat, 10 Mar 2012 02:27:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2A2R4eU035392; Sat, 10 Mar 2012 02:27:04 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2A2R4GN035390; Sat, 10 Mar 2012 02:27:04 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201203100227.q2A2R4GN035390@svn.freebsd.org> From: Ryan Stone Date: Sat, 10 Mar 2012 02:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232757 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2012 02:27:05 -0000 Author: rstone Date: Sat Mar 10 02:27:04 2012 New Revision: 232757 URL: http://svn.freebsd.org/changeset/base/232757 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/8/sys/kern/kern_kthread.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_kthread.c ============================================================================== --- stable/8/sys/kern/kern_kthread.c Sat Mar 10 02:26:12 2012 (r232756) +++ stable/8/sys/kern/kern_kthread.c Sat Mar 10 02:27:04 2012 (r232757) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -116,6 +117,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); @@ -300,6 +304,9 @@ kthread_add(void (*func)(void *), void * PROC_UNLOCK(p); + /* 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);