diff options
author | jhb <jhb@FreeBSD.org> | 2004-11-05 19:14:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2004-11-05 19:14:02 +0000 |
commit | 88680af3b70fdde865263d8442115ae597f65d88 (patch) | |
tree | b735c8fedf5e152a692473c69c30ba49d026453f | |
parent | c19696c19734f3afbd37926757495a09fab30cd6 (diff) | |
download | FreeBSD-src-88680af3b70fdde865263d8442115ae597f65d88.zip FreeBSD-src-88680af3b70fdde865263d8442115ae597f65d88.tar.gz |
- Set the priority of the page zeroing thread using sched_prio() when the
thread is created rather than adjusting the priority in the main
function. (kthread_create() should probably take the initial priority
as an argument.)
- Only yield the CPU in the !PREEMPTION case if there are any other
runnable threads. Yielding when there isn't anything else better to do
just wastes time in pointless context switches (albeit while the system
is idle.)
-rw-r--r-- | sys/vm/vm_zeroidle.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c index 9abd5f1..2609c2d 100644 --- a/sys/vm/vm_zeroidle.c +++ b/sys/vm/vm_zeroidle.c @@ -141,36 +141,26 @@ vm_page_zero_idle_wakeup(void) static void vm_pagezero(void __unused *arg) { - struct rtprio rtp; struct thread *td; - int pages, pri; td = curthread; - rtp.prio = RTP_PRIO_MAX; - rtp.type = RTP_PRIO_IDLE; - pages = 0; - mtx_lock_spin(&sched_lock); - rtp_to_pri(&rtp, td->td_ksegrp); - pri = td->td_priority; - mtx_unlock_spin(&sched_lock); idlezero_enable = idlezero_enable_default; for (;;) { if (vm_page_zero_check()) { - pages += vm_page_zero_idle(); + vm_page_zero_idle(); #ifndef PREEMPTION - if (pages > idlezero_maxrun || sched_runnable()) { + if (sched_runnable()) { mtx_lock_spin(&sched_lock); mi_switch(SW_VOL, NULL); mtx_unlock_spin(&sched_lock); - pages = 0; } #endif } else { vm_page_lock_queues(); wakeup_needed = TRUE; - msleep(&zero_state, &vm_page_queue_mtx, PDROP | pri, - "pgzero", hz * 300); + msleep(&zero_state, &vm_page_queue_mtx, + PDROP | td->td_priority, "pgzero", hz * 300); pages = 0; } } @@ -194,6 +184,7 @@ pagezero_start(void __unused *arg) pagezero_proc->p_flag |= P_NOLOAD; PROC_UNLOCK(pagezero_proc); mtx_lock_spin(&sched_lock); + sched_prio(FIRST_THREAD_IN_PROC(pagezero_proc), PRI_MAX_IDLE); setrunqueue(FIRST_THREAD_IN_PROC(pagezero_proc), SRQ_BORING); mtx_unlock_spin(&sched_lock); } |