kernel - Optimize idle thread halt
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 19 Dec 2010 19:17:36 +0000 (11:17 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 19 Dec 2010 19:17:36 +0000 (11:17 -0800)
commitbe71787bd3c8d2d199af9bb30ffb6df730c6b858
treebba54a5727ebde3c2a495722880e79db635a4339
parent0f0466c0c36e1dc71c1917d6835dca144fb80cb3
kernel - Optimize idle thread halt

* Count the number of times the idle thread is entered on a cpu without
  switching to a non-idle thread.  Use the fast-halt (non-ACPI) until the
  count exceeds a reasonable machdep.cpu_idle_repeat.

  This improves the default performance to levels closer to cpu_idle_hlt
  mode 1 but still gives us the power savings from mode 3.  Performanced is
  improved significantly because many threads on SMP boxes are event
  or pipe oriented and only sleep for short periods of time or ping-pong
  back and forth.  For example, a cc -pipe, or typical kernel threads
  blocking on tokens or locks for short periods of time.

* Adjust machdep.cpu_idle_hlt modes:

    0 Never halt, the idle thread just spins.

    1 Always use a fast HLT/MONITOR/MWAIT

    2 Hybrid approach use (1) up to a certain point, then use (3).
(this is the default)

    3 Always use the ACPI halt
sys/kern/lwkt_thread.c
sys/platform/pc32/i386/machdep.c
sys/platform/pc64/x86_64/machdep.c
sys/sys/globaldata.h