vm_zeroidle.c (170170) | vm_zeroidle.c (170307) |
---|---|
1/*- 2 * Copyright (c) 1994 John Dyson 3 * Copyright (c) 2001 Matt Dillon 4 * 5 * All Rights Reserved. 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 31 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ 32 * from: FreeBSD: .../i386/vm_machdep.c,v 1.165 2001/07/04 23:27:04 dillon 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1994 John Dyson 3 * Copyright (c) 2001 Matt Dillon 4 * 5 * All Rights Reserved. 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 31 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ 32 * from: FreeBSD: .../i386/vm_machdep.c,v 1.165 2001/07/04 23:27:04 dillon 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/vm/vm_zeroidle.c 170170 2007-05-31 22:52:15Z attilio $"); | 36__FBSDID("$FreeBSD: head/sys/vm/vm_zeroidle.c 170307 2007-06-05 00:00:57Z jeff $"); |
37 38#include <opt_sched.h> 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/proc.h> 44#include <sys/vmmeter.h> --- 95 unchanged lines hidden (view full) --- 140 idlezero_enable = idlezero_enable_default; 141 142 mtx_lock(&vm_page_queue_free_mtx); 143 for (;;) { 144 if (vm_page_zero_check()) { 145 vm_page_zero_idle(); 146#ifndef PREEMPTION 147 if (sched_runnable()) { | 37 38#include <opt_sched.h> 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/proc.h> 44#include <sys/vmmeter.h> --- 95 unchanged lines hidden (view full) --- 140 idlezero_enable = idlezero_enable_default; 141 142 mtx_lock(&vm_page_queue_free_mtx); 143 for (;;) { 144 if (vm_page_zero_check()) { 145 vm_page_zero_idle(); 146#ifndef PREEMPTION 147 if (sched_runnable()) { |
148 mtx_lock_spin(&sched_lock); | 148 thread_lock(curthread); |
149 mi_switch(SW_VOL, NULL); | 149 mi_switch(SW_VOL, NULL); |
150 mtx_unlock_spin(&sched_lock); | 150 thread_unlock(curthread); |
151 } 152#endif 153 } else { 154 wakeup_needed = TRUE; 155 msleep(&zero_state, &vm_page_queue_free_mtx, 0, 156 "pgzero", hz * 300); 157 } 158 } --- 12 unchanged lines hidden (view full) --- 171 if (error) 172 panic("pagezero_start: error %d\n", error); 173 /* 174 * We're an idle task, don't count us in the load. 175 */ 176 PROC_LOCK(pagezero_proc); 177 pagezero_proc->p_flag |= P_NOLOAD; 178 PROC_UNLOCK(pagezero_proc); | 151 } 152#endif 153 } else { 154 wakeup_needed = TRUE; 155 msleep(&zero_state, &vm_page_queue_free_mtx, 0, 156 "pgzero", hz * 300); 157 } 158 } --- 12 unchanged lines hidden (view full) --- 171 if (error) 172 panic("pagezero_start: error %d\n", error); 173 /* 174 * We're an idle task, don't count us in the load. 175 */ 176 PROC_LOCK(pagezero_proc); 177 pagezero_proc->p_flag |= P_NOLOAD; 178 PROC_UNLOCK(pagezero_proc); |
179 mtx_lock_spin(&sched_lock); | |
180 td = FIRST_THREAD_IN_PROC(pagezero_proc); | 179 td = FIRST_THREAD_IN_PROC(pagezero_proc); |
180 thread_lock(td); |
|
181 sched_class(td, PRI_IDLE); 182 sched_prio(td, PRI_MAX_IDLE); 183 sched_add(td, SRQ_BORING); | 181 sched_class(td, PRI_IDLE); 182 sched_prio(td, PRI_MAX_IDLE); 183 sched_add(td, SRQ_BORING); |
184 mtx_unlock_spin(&sched_lock); | 184 thread_unlock(td); |
185} 186SYSINIT(pagezero, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, pagezero_start, NULL) | 185} 186SYSINIT(pagezero, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, pagezero_start, NULL) |