git: kernel - usched_dfly revamp (8), add reschedule hints

Matthew Dillon dillon at
Tue Sep 25 19:19:51 PDT 2012

commit a3ef5f2ea61017aa6275c92777dc5f693f2ca494
Author: Matthew Dillon <dillon at>
Date:   Tue Sep 25 19:13:39 2012 -0700

    kernel - usched_dfly revamp (8), add reschedule hints
    * Add reschedule hints when issuing a read() on a pipe or socket, or
      issuing a blocking kevent() call.
    * usched_dfly will force a reschedule after the round-robin count has
      passed the half-way point if it detects a scheduling hint.  This is
      an attempt to avoid rescheduling in the middle of some critical user
      operation (e.g. postgres server holding internal locks).
    * Add kern.usched_dfly.fast_resched which allows the scheduler to avoid
      interrupting a less desireable process with a more desireable process
      as long as the priority difference is not too great.
      However, default the value to 0, because setting the value has
      consequences for interactive responsiveness.
    * When running pgbench we recommend leaving fast_resched disabled and
      instead running the pgbench at idprio 15 to work around issues where
      the postgres server process(es) get interrupted by the pgbench processes
      which causes the postgres server process(es) to hit internal lock conflicts
      more quickly and enter a semaphore wait more often (when both pgbench and
      the postgres servers are running on the same machine).
      This is really an issue with postgres server scaling.  Because the pgbench's
      use so much less cpu than the postgres server processes they are given a
      more desireable priority and thus can interrupt the postgres server
      processes.  We can't really 'fix' this in the scheduler without really
      messing up normal interactive responsiveness for the system.
      idprio pgbench -j 80 -c 80 -T 60 -S bench

Summary of changes:
 sys/kern/kern_event.c  |    5 ++-
 sys/kern/sys_pipe.c    |    2 +
 sys/kern/sys_socket.c  |    2 +
 sys/kern/usched_dfly.c |  141 ++++++++++++++++++++++++++++++++----------------
 sys/sys/thread.h       |    1 +
 5 files changed, 104 insertions(+), 47 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list