mpi@ notes that alpha doesn't set schedhz anymore, so schedhz is
always zero and serves no purpose.

We could remove it (patch below).  Or we could wait a bit to see if
schedclock() finds a future as an independent clock interrupt.

My guess is that roundrobin() (or something like it) will have a
future as a deadline clock interrupt -- when it fires, the running
thread is preempted if it is in userspace.  Or something like that.

I don't know about schedclock(), though.  I have a hard time imagining
the need to adjust the priority of the running thread *during* the
clock interrupt.  Even as I write that down, it sounds like a hack.

This patch deletes the variable and its sole remaining reference in
statclock().  Note that schedclock() itself remains in place and still
runs at its default frequency, approximately (stathz / 8).

ok?  wait a bit?

Index: sys/sched.h
===================================================================
RCS file: /cvs/src/sys/sys/sched.h,v
retrieving revision 1.61
diff -u -p -r1.61 sched.h
--- sys/sched.h 11 Aug 2023 22:02:50 -0000      1.61
+++ sys/sched.h 8 Sep 2023 18:28:32 -0000
@@ -146,7 +146,6 @@ struct cpustats {
 #define        ESTCPULIM(e) min((e), NICE_WEIGHT * PRIO_MAX - SCHED_PPQ)
 
 extern uint32_t roundrobin_period;
-extern int schedhz;                    /* ideally: 16 */
 
 struct proc;
 void schedclock(struct proc *);
Index: kern/kern_clock.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_clock.c,v
retrieving revision 1.115
diff -u -p -r1.115 kern_clock.c
--- kern/kern_clock.c   23 Aug 2023 01:55:45 -0000      1.115
+++ kern/kern_clock.c   8 Sep 2023 18:28:32 -0000
@@ -79,7 +79,6 @@
  */
 
 int    stathz;
-int    schedhz;
 int    profhz;
 int    profprocs;
 int    ticks = INT_MAX - (15 * 60 * HZ);
@@ -295,13 +294,10 @@ statclock(struct clockframe *frame)
        if (p != NULL) {
                p->p_cpticks++;
                /*
-                * If no schedclock is provided, call it here at ~~12-25 Hz;
-                * ~~16 Hz is best
+                * schedclock() runs every eighth statclock().
                 */
-               if (schedhz == 0) {
-                       if ((++spc->spc_schedticks & 3) == 0)
-                               schedclock(p);
-               }
+               if ((++spc->spc_schedticks & 3) == 0)
+                       schedclock(p);
        }
 }
 

Reply via email to