--- //depot/vendor/freebsd/src/sys/kern/kern_idle.c 2008/03/16 11:01:07 +++ //depot/user/attilio/attilio_freshh/sys/kern/kern_idle.c 2009/11/01 03:19:20 @@ -74,10 +74,9 @@ 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); --- //depot/vendor/freebsd/src/sys/kern/kern_intr.c 2009/10/15 18:55:13 +++ //depot/user/attilio/attilio_freshh/sys/kern/kern_intr.c 2009/11/01 03:19:20 @@ -1061,6 +1061,7 @@ 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; @@ -1085,11 +1086,10 @@ 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); } --- //depot/vendor/freebsd/src/sys/kern/sched_4bsd.c 2009/01/25 07:39:30 +++ //depot/user/attilio/attilio_freshh/sys/kern/sched_4bsd.c 2009/11/01 03:19:20 @@ -728,10 +728,10 @@ 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 @@ -937,7 +937,7 @@ thread_unlock(td); } - if ((p->p_flag & P_NOLOAD) == 0) + if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_rem(); if (newtd) @@ -980,7 +980,7 @@ ("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(); @@ -1289,7 +1289,7 @@ } } - 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) @@ -1338,7 +1338,7 @@ 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); @@ -1360,7 +1360,7 @@ "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) --- //depot/vendor/freebsd/src/sys/kern/sched_ule.c 2009/10/15 11:45:13 +++ //depot/user/attilio/attilio_freshh/sys/kern/sched_ule.c 2009/11/01 03:19:20 @@ -495,7 +495,7 @@ 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); } @@ -514,7 +514,7 @@ ("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); } --- //depot/vendor/freebsd/src/sys/sys/proc.h 2009/09/01 11:45:14 +++ //depot/user/attilio/attilio_freshh/sys/sys/proc.h 2009/11/01 03:21:41 @@ -322,7 +322,7 @@ #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-- */ @@ -558,7 +558,7 @@ #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. */ --- //depot/vendor/freebsd/src/sys/vm/vm_zeroidle.c 2008/08/03 14:30:13 +++ //depot/user/attilio/attilio_freshh/sys/vm/vm_zeroidle.c 2009/11/01 03:19:20 @@ -139,26 +139,21 @@ } } -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);