From owner-svn-src-head@FreeBSD.ORG Thu Jan 6 22:26:00 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 842371065670; Thu, 6 Jan 2011 22:26:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73E4F8FC1B; Thu, 6 Jan 2011 22:26:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p06MQ0SL030427; Thu, 6 Jan 2011 22:26:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p06MQ0fn030424; Thu, 6 Jan 2011 22:26:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201101062226.p06MQ0fn030424@svn.freebsd.org> From: John Baldwin Date: Thu, 6 Jan 2011 22:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r217079 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jan 2011 22:26:00 -0000 Author: jhb Date: Thu Jan 6 22:26:00 2011 New Revision: 217079 URL: http://svn.freebsd.org/changeset/base/217079 Log: - Properly initialize the base priority (td_base_pri) of thread0 to PVM to match the desired priority in td_priority. Otherwise the first time thread0 used a borrowed priority it would drop down to PUSER instead of PVM. - Explicitly initialize the starting priority of new kprocs to PVM to avoid inheriting some random priority from thread0. MFC after: 2 weeks Modified: head/sys/kern/init_main.c head/sys/kern/kern_kthread.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Jan 6 22:24:00 2011 (r217078) +++ head/sys/kern/init_main.c Thu Jan 6 22:26:00 2011 (r217079) @@ -462,7 +462,7 @@ proc0_init(void *dummy __unused) td->td_base_user_pri = PUSER; td->td_lend_user_pri = PRI_MAX; td->td_priority = PVM; - td->td_base_pri = PUSER; + td->td_base_pri = PVM; td->td_oncpu = 0; td->td_flags = TDF_INMEM|TDP_KTHREAD; td->td_cpuset = cpuset_thread0(); Modified: head/sys/kern/kern_kthread.c ============================================================================== --- head/sys/kern/kern_kthread.c Thu Jan 6 22:24:00 2011 (r217078) +++ head/sys/kern/kern_kthread.c Thu Jan 6 22:26:00 2011 (r217079) @@ -117,14 +117,15 @@ kproc_create(void (*func)(void *), void /* call the processes' main()... */ cpu_set_fork_handler(td, func, arg); + thread_lock(td); TD_SET_CAN_RUN(td); + sched_prio(td, PVM); + sched_user_prio(td, PUSER); /* Delay putting it on the run queue until now. */ - if (!(flags & RFSTOPPED)) { - thread_lock(td); + if (!(flags & RFSTOPPED)) sched_add(td, SRQ_BORING); - thread_unlock(td); - } + thread_unlock(td); return 0; }