git: kernel - Refactor smp collision statistics (2)

Matthew Dillon dillon at
Mon Oct 16 11:30:37 PDT 2017

commit b1793cc6ba47622ab6ad154905f5c1385a6825bd
Author: Matthew Dillon <dillon at>
Date:   Thu Oct 5 09:09:27 2017 -0700

    kernel - Refactor smp collision statistics (2)
    * Refactor indefinite_info mechanics.  Instead of tracking indefinite
      loops on a per-thread basis for tokens, track them on a scheduler
      basis.  The scheduler records the overhead while it is live-looping
      on tokens, but the moment it finds a thread it can actually schedule
      it stops (then restarts later the next time it is entered), even
      if some of the other threads still have unresolved tokens.
      This gives us a fairer representation of how many cpu cycles are
      actually being wasted waiting for tokens.
    * Go back to using a local indefinite_info in the lockmgr*(), mutex*(),
      and spinlock code.
    * Refactor lockmgr() by implementing an __inline frontend to
      interpret the directive.  Since this argument is usually a constant,
      the change effectively removes the switch().
      Use LK_NOCOLLSTATS to create a clean recursion to wrap the blocking
      case with the indefinite*() API.

Summary of changes:
 sys/kern/kern_lock.c     | 355 +++++++++++++++++++++++++++++++----------------
 sys/kern/kern_mutex.c    |  10 +-
 sys/kern/kern_spinlock.c |  16 +--
 sys/kern/lwkt_thread.c   |   6 +-
 sys/kern/lwkt_token.c    |  23 ++-
 sys/sys/globaldata.h     |   4 +
 sys/sys/indefinite2.h    |  27 ++--
 sys/sys/lock.h           |  59 +++++---
 sys/sys/thread.h         |   4 -
 9 files changed, 321 insertions(+), 183 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list