git: kernel - Misc adjustments used by the vkernel and VMM, misc optimizations

Matthew Dillon dillon at
Fri Sep 13 19:07:45 PDT 2013

commit 8cee56f46a3ba3b169e5c0b4716c457bc9d03164
Author: Matthew Dillon <dillon at>
Date:   Fri Sep 13 19:02:55 2013 -0700

    kernel - Misc adjustments used by the vkernel and VMM, misc optimizations
    * This section committed separately because it is basically independent
      of VMM.
    * Improve pfind().  Don't get proc_token if the process being looked up
      is the current process.
    * Improve kern_kill().  Do not obtain proc_token any more.  p->p_token
      is sufficient and the process group has its own lock now.
    * Call pthread_yield() when spinning on various things.
        x Spinlocks
        x Tokens (spinning in lwkt_switch)
        x cpusync (ipiq)
    * Rewrite sched_yield() -> dfly_yield().  dfly_yield() will
      unconditionally round-robin the LWP, ignoring estcpu.  It isn't
      perfect but it works fairly well.
      The dfly scheduler will also no longer attempt to migrate threads
      across cpus when handling yields.  They migrate normally in all
      other circumstances.
      This fixes situations where the vkernel is spinning waiting for multiple
      events from other cpus and in particular when it is doing a global IPI
      for pmap synchronization of the kernel_pmap.

Summary of changes:
 sys/kern/kern_proc.c     | 14 ++++++++-
 sys/kern/kern_sig.c      | 18 +++--------
 sys/kern/kern_spinlock.c | 10 +++++++
 sys/kern/lwkt_ipiq.c     | 13 ++++++++
 sys/kern/lwkt_thread.c   | 13 ++++++++
 sys/kern/usched_dfly.c   | 78 +++++++++++++++++++++++++++++++++++-------------
 sys/sys/thread.h         |  1 +
 7 files changed, 111 insertions(+), 36 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list