From owner-svn-src-all@FreeBSD.ORG Sat Feb 5 21:50:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98F5F106564A; Sat, 5 Feb 2011 21:50:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87C9C8FC16; Sat, 5 Feb 2011 21:50:23 +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 p15LoNj5042399; Sat, 5 Feb 2011 21:50:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15LoNFt042392; Sat, 5 Feb 2011 21:50:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201102052150.p15LoNFt042392@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 5 Feb 2011 21:50:23 +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: r218352 - in stable/8/sys: kern sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Feb 2011 21:50:23 -0000 Author: kib Date: Sat Feb 5 21:50:23 2011 New Revision: 218352 URL: http://svn.freebsd.org/changeset/base/218352 Log: MFC r198854 (by attilio): Split P_NOLOAD into a per-thread flag (TDF_NOLOAD) Approved by: attilio Modified: stable/8/sys/kern/kern_idle.c stable/8/sys/kern/kern_intr.c stable/8/sys/kern/sched_4bsd.c stable/8/sys/kern/sched_ule.c stable/8/sys/sys/proc.h stable/8/sys/vm/vm_zeroidle.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_idle.c ============================================================================== --- stable/8/sys/kern/kern_idle.c Sat Feb 5 21:47:04 2011 (r218351) +++ stable/8/sys/kern/kern_idle.c Sat Feb 5 21:50:23 2011 (r218352) @@ -74,10 +74,9 @@ idle_setup(void *dummy) if (error) panic("idle_setup: kproc_create error %d\n", error); - p->p_flag |= P_NOLOAD; thread_lock(td); TD_SET_CAN_RUN(td); - td->td_flags |= TDF_IDLETD; + td->td_flags |= TDF_IDLETD | TDF_NOLOAD; sched_class(td, PRI_IDLE); sched_prio(td, PRI_MAX_IDLE); thread_unlock(td); Modified: stable/8/sys/kern/kern_intr.c ============================================================================== --- stable/8/sys/kern/kern_intr.c Sat Feb 5 21:47:04 2011 (r218351) +++ stable/8/sys/kern/kern_intr.c Sat Feb 5 21:50:23 2011 (r218352) @@ -1057,6 +1057,7 @@ int swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, void *arg, int pri, enum intr_type flags, void **cookiep) { + struct thread *td; struct intr_event *ie; int error; @@ -1081,11 +1082,10 @@ swi_add(struct intr_event **eventp, cons if (error) return (error); if (pri == SWI_CLOCK) { - struct proc *p; - p = ie->ie_thread->it_thread->td_proc; - PROC_LOCK(p); - p->p_flag |= P_NOLOAD; - PROC_UNLOCK(p); + td = ie->ie_thread->it_thread; + thread_lock(td); + td->td_flags |= TDF_NOLOAD; + thread_unlock(td); } return (0); } Modified: stable/8/sys/kern/sched_4bsd.c ============================================================================== --- stable/8/sys/kern/sched_4bsd.c Sat Feb 5 21:47:04 2011 (r218351) +++ stable/8/sys/kern/sched_4bsd.c Sat Feb 5 21:50:23 2011 (r218352) @@ -728,10 +728,10 @@ sched_exit_thread(struct thread *td, str thread_lock(td); td->td_estcpu = ESTCPULIM(td->td_estcpu + child->td_estcpu); thread_unlock(td); - mtx_lock_spin(&sched_lock); - if ((child->td_proc->p_flag & P_NOLOAD) == 0) + thread_lock(child); + if ((child->td_flags & TDF_NOLOAD) == 0) sched_load_rem(); - mtx_unlock_spin(&sched_lock); + thread_unlock(child); } void @@ -941,7 +941,7 @@ sched_switch(struct thread *td, struct t tmtx = thread_lock_block(td); } - if ((p->p_flag & P_NOLOAD) == 0) + if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_rem(); if (newtd) { @@ -986,7 +986,7 @@ sched_switch(struct thread *td, struct t ("trying to run inhibited thread")); newtd->td_flags |= TDF_DIDRUN; TD_SET_RUNNING(newtd); - if ((newtd->td_proc->p_flag & P_NOLOAD) == 0) + if ((newtd->td_flags & TDF_NOLOAD) == 0) sched_load_add(); } else { newtd = choosethread(); @@ -1293,7 +1293,7 @@ sched_add(struct thread *td, int flags) } } - if ((td->td_proc->p_flag & P_NOLOAD) == 0) + if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_add(); runq_add(ts->ts_runq, td, flags); if (cpu != NOCPU) @@ -1342,7 +1342,7 @@ sched_add(struct thread *td, int flags) if (maybe_preempt(td)) return; } - if ((td->td_proc->p_flag & P_NOLOAD) == 0) + if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_add(); runq_add(ts->ts_runq, td, flags); maybe_resched(td); @@ -1364,7 +1364,7 @@ sched_rem(struct thread *td) "prio:%d", td->td_priority, KTR_ATTR_LINKED, sched_tdname(curthread)); - if ((td->td_proc->p_flag & P_NOLOAD) == 0) + if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_rem(); #ifdef SMP if (ts->ts_runq != &runq) Modified: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Sat Feb 5 21:47:04 2011 (r218351) +++ stable/8/sys/kern/sched_ule.c Sat Feb 5 21:50:23 2011 (r218352) @@ -504,7 +504,7 @@ tdq_load_add(struct tdq *tdq, struct thr THREAD_LOCK_ASSERT(td, MA_OWNED); tdq->tdq_load++; - if ((td->td_proc->p_flag & P_NOLOAD) == 0) + if ((td->td_flags & TDF_NOLOAD) == 0) tdq->tdq_sysload++; KTR_COUNTER0(KTR_SCHED, "load", tdq->tdq_loadname, tdq->tdq_load); } @@ -523,7 +523,7 @@ tdq_load_rem(struct tdq *tdq, struct thr ("tdq_load_rem: Removing with 0 load on queue %d", TDQ_ID(tdq))); tdq->tdq_load--; - if ((td->td_proc->p_flag & P_NOLOAD) == 0) + if ((td->td_flags & TDF_NOLOAD) == 0) tdq->tdq_sysload--; KTR_COUNTER0(KTR_SCHED, "load", tdq->tdq_loadname, tdq->tdq_load); } Modified: stable/8/sys/sys/proc.h ============================================================================== --- stable/8/sys/sys/proc.h Sat Feb 5 21:47:04 2011 (r218351) +++ stable/8/sys/sys/proc.h Sat Feb 5 21:50:23 2011 (r218352) @@ -353,7 +353,7 @@ do { \ #define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */ #define TDF_NEEDRESCHED 0x00010000 /* Thread needs to yield. */ #define TDF_NEEDSIGCHK 0x00020000 /* Thread may need signal delivery. */ -#define TDF_UNUSED18 0x00040000 /* --available-- */ +#define TDF_NOLOAD 0x00040000 /* Ignore during load avg calculations. */ #define TDF_UNUSED19 0x00080000 /* Thread is sleeping on a umtx. */ #define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */ #define TDF_UNUSED21 0x00200000 /* --available-- */ @@ -573,7 +573,7 @@ struct proc { #define P_ADVLOCK 0x00001 /* Process may hold a POSIX advisory lock. */ #define P_CONTROLT 0x00002 /* Has a controlling terminal. */ #define P_KTHREAD 0x00004 /* Kernel thread (*). */ -#define P_NOLOAD 0x00008 /* Ignore during load avg calculations. */ +#define P_UNUSED0 0x00008 /* available. */ #define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */ #define P_PROFIL 0x00020 /* Has started profiling. */ #define P_STOPPROF 0x00040 /* Has thread requesting to stop profiling. */ Modified: stable/8/sys/vm/vm_zeroidle.c ============================================================================== --- stable/8/sys/vm/vm_zeroidle.c Sat Feb 5 21:47:04 2011 (r218351) +++ stable/8/sys/vm/vm_zeroidle.c Sat Feb 5 21:50:23 2011 (r218352) @@ -139,26 +139,21 @@ vm_pagezero(void __unused *arg) } } -static struct proc *pagezero_proc; - static void pagezero_start(void __unused *arg) { int error; + struct proc *p; struct thread *td; - error = kproc_create(vm_pagezero, NULL, &pagezero_proc, RFSTOPPED, 0, - "pagezero"); + error = kproc_create(vm_pagezero, NULL, &p, RFSTOPPED, 0, "pagezero"); if (error) panic("pagezero_start: error %d\n", error); - /* - * We're an idle task, don't count us in the load. - */ - PROC_LOCK(pagezero_proc); - pagezero_proc->p_flag |= P_NOLOAD; - PROC_UNLOCK(pagezero_proc); - td = FIRST_THREAD_IN_PROC(pagezero_proc); + td = FIRST_THREAD_IN_PROC(p); thread_lock(td); + + /* We're an idle task, don't count us in the load. */ + td->td_flags |= TDF_NOLOAD; sched_class(td, PRI_IDLE); sched_prio(td, PRI_MAX_IDLE); sched_add(td, SRQ_BORING);