diff options
author | jeff <jeff@FreeBSD.org> | 2004-02-02 07:51:03 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2004-02-02 07:51:03 +0000 |
commit | 60c153f457880bd6aedf32abbbbed0451589c1e7 (patch) | |
tree | df9a1faaf54cd1a8645db563e8b07e8c1da831af /sys/vm | |
parent | 11851979c2627465710ba2bb20a6b13e2b2b9f1a (diff) | |
download | FreeBSD-src-60c153f457880bd6aedf32abbbbed0451589c1e7.zip FreeBSD-src-60c153f457880bd6aedf32abbbbed0451589c1e7.tar.gz |
- Use a seperate startup function for the zeroidle kthread. Use this to
set P_NOLOAD prior to running the thread.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_zeroidle.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c index 863804a..c2e8b66 100644 --- a/sys/vm/vm_zeroidle.c +++ b/sys/vm/vm_zeroidle.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sched.h> #include <sys/sysctl.h> #include <sys/kthread.h> +#include <sys/unistd.h> #include <vm/vm.h> #include <vm/vm_page.h> @@ -130,7 +131,7 @@ vm_page_zero_idle_wakeup(void) } static void -vm_pagezero(void) +vm_pagezero(void __unused *arg) { struct thread *td; struct proc *p; @@ -146,9 +147,6 @@ vm_pagezero(void) rtp_to_pri(&rtp, td->td_ksegrp); pri = td->td_priority; mtx_unlock_spin(&sched_lock); - PROC_LOCK(p); - p->p_flag |= P_NOLOAD; - PROC_UNLOCK(p); for (;;) { if (vm_page_zero_check()) { @@ -167,9 +165,24 @@ vm_pagezero(void) } static struct proc *pagezero_proc; -static struct kproc_desc pagezero_kp = { - "pagezero", - vm_pagezero, - &pagezero_proc -}; -SYSINIT(pagezero, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, kproc_start, &pagezero_kp) + +static void +pagezero_start(void __unused *arg) +{ + int error; + + error = kthread_create(vm_pagezero, NULL, &pagezero_proc, 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); + mtx_lock_spin(&sched_lock); + setrunqueue(FIRST_THREAD_IN_PROC(pagezero_proc)); + mtx_unlock_spin(&sched_lock); +} +SYSINIT(pagezero, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, pagezero_start, NULL) |