kernel - usched_dfly revamp (8), add reschedule hints
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 26 Sep 2012 02:13:39 +0000 (19:13 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 26 Sep 2012 02:13:39 +0000 (19:13 -0700)
commita3ef5f2ea61017aa6275c92777dc5f693f2ca494
tree9cdb0e4cf6279bd2e9221df9086c11dce93e9786
parente3e6be1f3ada3078bf270c3a65637a84a95c4585
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.

  Example:

  idprio pgbench -j 80 -c 80 -T 60 -S bench
sys/kern/kern_event.c
sys/kern/sys_pipe.c
sys/kern/sys_socket.c
sys/kern/usched_dfly.c
sys/sys/thread.h