View | Details | Raw Unified | Return to bug 246940 | Differences between
and this patch

Collapse All | Expand All

(-)sys/kern/kern_clock.c (-1 / +9 lines)
Lines 614-623 Link Here
614
			cpu_stopprofclock();
614
			cpu_stopprofclock();
615
		mtx_unlock(&time_lock);
615
		mtx_unlock(&time_lock);
616
	}
616
	}
617
}
617
}
618
618
619
620
static int cp_time_mode = 0;
621
SYSCTL_INT(_kern, OID_AUTO, cp_time_mode, CTLFLAG_RW, &cp_time_mode, 0,
622
    "Charge idle threads as: 0=user (default), 1=nice (server), 2=idle (desktop/mobile)");
623
619
/*
624
/*
620
 * Statistics clock.  Updates rusage information and calls the scheduler
625
 * Statistics clock.  Updates rusage information and calls the scheduler
621
 * to adjust priorities of the active thread.
626
 * to adjust priorities of the active thread.
622
 *
627
 *
623
 * This should be called by all active processors.
628
 * This should be called by all active processors.
Lines 640-650 Link Here
640
	if (usermode) {
645
	if (usermode) {
641
		/*
646
		/*
642
		 * Charge the time as appropriate.
647
		 * Charge the time as appropriate.
643
		 */
648
		 */
644
		td->td_uticks += cnt;
649
		td->td_uticks += cnt;
645
		if (p->p_nice > NZERO)
650
		if (cp_time_mode == 2 && td->td_pri_class == PRI_IDLE)
651
			cp_time[CP_IDLE] += cnt;
652
		else if (p->p_nice > NZERO ||
653
		   (cp_time_mode == 1 && td->td_pri_class == PRI_IDLE))
646
			cp_time[CP_NICE] += cnt;
654
			cp_time[CP_NICE] += cnt;
647
		else
655
		else
648
			cp_time[CP_USER] += cnt;
656
			cp_time[CP_USER] += cnt;
649
	} else {
657
	} else {
650
		/*
658
		/*

Return to bug 246940