kernel - Major vm_page, lwkt thread, and other changes
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 26 Oct 2011 18:26:48 +0000 (11:26 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 26 Oct 2011 18:26:48 +0000 (11:26 -0700)
commit85946b6c2b43282c61a9fcb6b0b9581a85f65eee
treec6220ae10c2621f36c6f1e313657bda8a483e231
parentd7f4c4580f6b8a093c3bbc4f277955463d74e107
kernel - Major vm_page, lwkt thread, and other changes

* Remove the rest of the LWKT fairq code, it may be added back in a different
  form later.  Go back to the strict priority model with round-robining
  of same-priority LWKT threads.

  Currently the model scans gd_tdrunq for sort insertion, which is probably
  a bit too inefficient.

* Refactor the LWKT scheduler clock.  The round-robining is now based on
  the head of gd->gd_tdrunq and the lwkt_schedulerclock() function will
  move it.  When a thread not on the head is selected to run (because
  the head is contending on a token), the round-robin tick will force a
  resched on the next tick.  As before, we never reschedule-ahead the
  kernel scheduler helper thread or threads that have already dropped
  to a user priority.

* The token code now tries a little harder to acquire the token before
  giving up, controllable with lwkt.token_spin and lwkt.token_delay
  (token_spin is the number of times to try and token_delay is the delay
  between tries, in nanoseconds).

* Fix a serious bug in usched_bsd4.c which improperly reassigned the 'dd'
  variable and caused the scheduler helper to monitor the wrong dd
  structure.

* Refactor the vm_page coloring code.  On SMP systems we now use the
  coloring code to implement cpu localization when allocating pages.
  The pages are still 'twisted' based on their physical address so both
  functions are served, but cpu localization is now the more important
  function.

* Implement NON-OBJECT vm_page allocations.  NULL may now be passed, which
  allocates a VM page unassociated with any VM object.  This will be
  used by the pmap code.

* Implement cpu localization for zalloc() and friends.  This removes a major
  contention point when handling concurrent VM faults.  The only major
  contention point left is the PQ_INACTIVE vm_page_queues[] queue.

* Temporarily remove the VM_ALLOC_ZERO request.  This will probably be
  reenabled in a later commit.

* Remove MSGF_NORESCHED (it is not being used) and simplify related
  lwkt scheduler functions.

* schedcpu_stats() and schedcpu_resource() no longer stall the callout
  kernel threads when scanning allproc, if they are unable to acquire
  proc->p_token.

* Move the need_lwkt_resched() from hardclock() to lwkt_schedulerclock()
  (which hardclock() calls).
16 files changed:
sys/kern/kern_clock.c
sys/kern/kern_synch.c
sys/kern/lwkt_msgport.c
sys/kern/lwkt_thread.c
sys/kern/lwkt_token.c
sys/kern/usched_bsd4.c
sys/kern/vfs_bio.c
sys/sys/globaldata.h
sys/sys/msgport.h
sys/sys/thread.h
sys/vm/vm_fault.c
sys/vm/vm_object.c
sys/vm/vm_page.c
sys/vm/vm_page.h
sys/vm/vm_zone.c
sys/vm/vm_zone.h