From 3b1acbdce295a5ace27e22dba0ae318570aea5bf Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 12 Mar 2008 06:31:06 +0000 Subject: - Pass the priority argument from *sleep() into sleepq and down into sched_sleep(). This removes extra thread_lock() acquisition and allows the scheduler to decide what to do with the static boost. - Change the priority arguments to cv_* to match sleepq/msleep/etc. where 0 means no priority change. Catch -1 in cv_broadcastpri() and convert it to 0 for now. - Set a flag when sleeping in a way that is compatible with swapping since direct priority comparisons are meaningless now. - Add a sysctl to ule, kern.sched.static_boost, that defaults to on which controls the boost behavior. Turning it off gives better performance in some workloads but needs more investigation. - While we're modifying sleepq, change signal and broadcast to both return with the lock held as the lock was held on enter. Reviewed by: jhb, peter --- sys/vm/vm_meter.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'sys/vm/vm_meter.c') diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index d949fbf..d71eabf 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -95,7 +95,6 @@ SYSCTL_PROC(_vm, VM_LOADAVG, loadavg, CTLTYPE_STRUCT|CTLFLAG_RD, static int vmtotal(SYSCTL_HANDLER_ARGS) { -/* XXXKSE almost completely broken */ struct proc *p; struct vmtotal total; vm_map_entry_t entry; @@ -139,25 +138,16 @@ vmtotal(SYSCTL_HANDLER_ARGS) break; default: FOREACH_THREAD_IN_PROC(p, td) { - /* Need new statistics XXX */ thread_lock(td); switch (td->td_state) { case TDS_INHIBITED: - /* - * XXX stats no longer synchronized. - */ - if (TD_ON_LOCK(td) || - (td->td_inhibitors == - TDI_SWAPPED)) { + if (TD_IS_SWAPPED(td)) total.t_sw++; - } else if (TD_IS_SLEEPING(td) || - TD_AWAITING_INTR(td) || - TD_IS_SUSPENDED(td)) { - if (td->td_priority <= PZERO) - total.t_dw++; - else - total.t_sl++; - } + else if (TD_IS_SLEEPING(td) && + td->td_priority <= PZERO) + total.t_dw++; + else + total.t_sl++; break; case TDS_CAN_RUN: -- cgit v1.1