sched_bsd.c: update comment about p_pctcpu
It's also used in top, systat, and tty status (^T). Index: sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sched_bsd.c 8 Nov 2015 20:45:57 - 1.42 +++ sched_bsd.c 7 Mar 2016 17:44:30 - @@ -233,7 +233,7 @@ schedcpu(void *arg) continue; SCHED_LOCK(s); /* -* p_pctcpu is only for ps. +* p_pctcpu is only for diagnostic tools such as ps. */ #if(FSHIFT >= CCPU_SHIFT) p->p_pctcpu += (phz == 100)? -- Michal Mazurek
sched_bsd.c: update comment
Some time ago p_swptime was removed: - p->p_swtime++; if (p->p_stat == SSLEEP || p->p_stat == SSTOP) p->p_slptime++; But the comment still mentions it. What type p_swtime had and how someone concluded it overflows in 45 days I do not know. p_slptime is a u_int, so if incremented once a second an overflow will occur every 136 years. Also add a declaration for updatepri() and remove a trailing empty line. Index: sys/kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c8 Nov 2015 20:45:57 - 1.42 +++ sys/kern/sched_bsd.c7 Mar 2016 17:15:27 - @@ -60,7 +60,8 @@ int rrticks_init; /* # of hardclock tic struct __mp_lock sched_lock; #endif -void schedcpu(void *); +voidschedcpu(void *); +voidupdatepri(struct proc *); void scheduler_start(void) @@ -218,9 +219,7 @@ schedcpu(void *arg) LIST_FOREACH(p, , p_list) { /* -* Increment time in/out of memory and sleep time -* (if sleeping). We ignore overflow; with 16-bit int's -* (remember them?) overflow takes 45 days. +* Increment sleep time (if sleeping). We ignore overflow. */ if (p->p_stat == SSLEEP || p->p_stat == SSTOP) p->p_slptime++; @@ -715,4 +714,3 @@ sysctl_hwperfpolicy(void *oldp, size_t * return 0; } #endif - -- Michal Mazurek
Re: sched_bsd.c update comment
On 16:20:11, 1.03.16, Michal Mazurek wrote: > > Index: sys/kern/sched_bsd.c > === > RCS file: /cvs/src/sys/kern/sched_bsd.c,v > retrieving revision 1.42 > diff -u -p -r1.42 sched_bsd.c > --- sys/kern/sched_bsd.c 8 Nov 2015 20:45:57 - 1.42 > +++ sys/kern/sched_bsd.c 1 Mar 2016 15:19:24 - > @@ -70,8 +70,8 @@ scheduler_start(void) > /* >* We avoid polluting the global namespace by keeping the scheduler >* timeouts static in this function. > - * We setup the timeouts here and kick schedcpu and roundrobin once to > - * make them do their job. > + * We setup the timeouts here and kick schedcpu once to make it do > + * its job. >*/ > > timeout_set(_to, schedcpu, _to); The reason I'm proposing this change is because there used to be a call to roundrobin() in this function before, but then it went away: @@ -93,16 +81,9 @@ scheduler_start(void) * make them do their job. */ -#ifndef __HAVE_CPUINFO - timeout_set(_to, roundrobin, _to); -#endif timeout_set(_to, schedcpu, _to); -#ifdef __HAVE_CPUINFO rrticks_init = hz / 10; -#else - roundrobin(_to); -#endif schedcpu(_to); } Move a function declaration and remove an endline from the very end of the file while here: Index: sys/kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c8 Nov 2015 20:45:57 - 1.42 +++ sys/kern/sched_bsd.c5 Mar 2016 09:01:56 - @@ -60,7 +60,8 @@ int rrticks_init; /* # of hardclock tic struct __mp_lock sched_lock; #endif -void schedcpu(void *); +voidschedcpu(void *); +voidupdatepri(struct proc *); void scheduler_start(void) @@ -70,8 +71,8 @@ scheduler_start(void) /* * We avoid polluting the global namespace by keeping the scheduler * timeouts static in this function. -* We setup the timeouts here and kick schedcpu and roundrobin once to -* make them do their job. +* We setup the timeouts here and kick schedcpu once to make it do +* its job. */ timeout_set(_to, schedcpu, _to); @@ -715,4 +716,3 @@ sysctl_hwperfpolicy(void *oldp, size_t * return 0; } #endif - Index: sys/sys/sched.h === RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.39 diff -u -p -r1.39 sched.h --- sys/sys/sched.h 13 Sep 2015 11:15:11 - 1.39 +++ sys/sys/sched.h 5 Mar 2016 09:01:56 - @@ -139,7 +139,6 @@ void schedclock(struct proc *); struct cpu_info; void roundrobin(struct cpu_info *); void scheduler_start(void); -void updatepri(struct proc *); void userret(struct proc *p); void sched_init_cpu(struct cpu_info *); -- Michal Mazurek
sched_bsd.c update comment
Index: sys/kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c8 Nov 2015 20:45:57 - 1.42 +++ sys/kern/sched_bsd.c1 Mar 2016 15:19:24 - @@ -70,8 +70,8 @@ scheduler_start(void) /* * We avoid polluting the global namespace by keeping the scheduler * timeouts static in this function. -* We setup the timeouts here and kick schedcpu and roundrobin once to -* make them do their job. +* We setup the timeouts here and kick schedcpu once to make it do +* its job. */ timeout_set(_to, schedcpu, _to); -- Michal Mazurek