On 11/19/10 16:49, Taku YAMAMOTO wrote:

I have a dumb local hack to grant ts_slice proportional to the duration
the waking thread slept rather than unconditionally reset to sched_slice.


--- sys/kern/sched_ule.c.orig
+++ sys/kern/sched_ule.c
@@ -1928,12 +1928,16 @@ sched_wakeup(struct thread *td)
                u_int hzticks;

                hzticks = (ticks - slptick)<<  SCHED_TICK_SHIFT;
+               if (hzticks>  SCHED_SLP_RUN_MAX)
+                       hzticks = SCHED_SLP_RUN_MAX;
                ts->ts_slptime += hzticks;
+               /* Grant additional slices after we sleep. */
+               ts->ts_slice += hzticks / tickincr;
+               if (ts->ts_slice > sched_slice)
+                       ts->ts_slice = sched_slice;

If I read it correctly, now instead of the slice given to the thread being always sched_slice, now it is reduced to a value smaller than sched_slice based on how long did the thread sleep?

How does that help?

                sched_interact_update(td);
                sched_pctcpu_update(ts);
        }
-       /* Reset the slice value after we sleep. */
-       ts->ts_slice = sched_slice;
        sched_add(td, SRQ_BORING);
  }





_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to