git: kernel - Major vm_page, lwkt thread, and other changes

Matthew Dillon dillon at
Wed Oct 26 11:39:12 PDT 2011

commit 85946b6c2b43282c61a9fcb6b0b9581a85f65eee
Author: Matthew Dillon <dillon at>
Date:   Wed Oct 26 11:26:48 2011 -0700

    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
    * 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
    * 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
    * Move the need_lwkt_resched() from hardclock() to lwkt_schedulerclock()
      (which hardclock() calls).

Summary of changes:
 sys/kern/kern_clock.c   |   11 +--
 sys/kern/kern_synch.c   |   10 +-
 sys/kern/lwkt_msgport.c |    9 +-
 sys/kern/lwkt_thread.c  |  404 ++++++++++++++++++++--------------------------
 sys/kern/lwkt_token.c   |   21 ++-
 sys/kern/usched_bsd4.c  |   63 ++++----
 sys/kern/vfs_bio.c      |    9 +
 sys/sys/globaldata.h    |   22 ++--
 sys/sys/msgport.h       |    2 +-
 sys/sys/thread.h        |   24 +---
 sys/vm/vm_fault.c       |  111 ++++++++++----
 sys/vm/vm_object.c      |   20 ++-
 sys/vm/vm_page.c        |   84 +++++++---
 sys/vm/vm_page.h        |    3 +-
 sys/vm/vm_zone.c        |   85 +++++++++--
 sys/vm/vm_zone.h        |    2 +
 16 files changed, 490 insertions(+), 390 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list