cvs commit: src/sys/kern sched_4bsd.c

Ian Dowse iedowse at maths.tcd.ie
Sun Feb 1 07:55:11 PST 2004


In message <200402010645.i116jW7E096596 at gw.catspoiler.org>, Don Lewis writes:
>Yup, I missed the change in 1.59.  I did a binary search to find the
>version in vm_meter.c and found a slightly older version before the
>SSLEEP code had been removed.
>

FYI, the original change seems to date back to May 1990:

REV:7.7                 vm_meter.c          1990/05/02 19:07:25       mckusick

   do not count processes in load average sleeping over one second

--- vm_meter.c  1989/05/29 13:09:36     7.6
+++ vm_meter.c  1990/05/02 19:07:25     7.7
@@ -405,9 +405,10 @@
                        switch (p->p_stat) {
 
                        case SSLEEP:
+                               if (p->p_pri <= PZERO && p->p_slptime == 0)
+                                       nrun++;
+                               /* fall through */
                        case SSTOP:
-                               if (p->p_pri <= PZERO && p->p_stat == SSLEEP)
-                                       nrun++;
                                if (p->p_flag & SPAGE)
                                        total.t_pw++;
                                else if (p->p_flag & SLOAD) {

The bug here is that p->p_slptime has just been incremented in
schedcpu() immediately before loadav() is called, so it will never
be 0 here. Fixing this now is likely to trigger a lot of questions
and complaints, so it is left as an excercise for the brave :-)

Ian


More information about the cvs-src mailing list