git: kernel - fbsd kpi support, add sleepq*() API (untested)

Matthew Dillon dillon at crater.dragonflybsd.org
Wed Feb 15 10:11:23 PST 2023


commit 6d3dff5fd40db3cd5ce7d593596e39c85131215a
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Wed Feb 15 09:53:05 2023 -0800

    kernel - fbsd kpi support, add sleepq*() API (untested)
    
    * Initial sleepq*() API.  We use our tsleep*() API underneath it.  This
      is a horrible API so add a note that it should only be used for
      FreeBSD compat stuff.
    
      - Add tsleep/wakeup domains to implement the two sleepq*() queues.
    
      - Track blocking refs per queue in the sleepq API
    
      - Do not track individual threads (just let tsleep*()/wakeup*() do
        its thing).
    
      - objcache for wchan, 1K hash table for now, and retain a cache of
        available wchan structures in the hash table (up to 4 per slot).
    
      - Include the hash-slot spin lock as FreeBSD compat code will use it
        for interlock tests.
    
      - Relax sleepq_signal() a bit, allowing it to wakeup more than one
        thread (the DragonFly wakeup_*_one*() is a bit non-deterministic).
    
    * For now add discrete fields to the thread structure.  Its a bit of
      bloat but its better than dynamically allocating a side-structure.
      We already use our tsleep*() API and related fields underneath.
      Add a few more needed for tracking the wchan structure, the queue,
      and the timeout.
    
    * Add sbintime_t type (as 64-bit ticks), and a sbticks global
      counter.  Monotonic ticks since boot, 64 bits.

Summary of changes:
 sys/conf/files             |   1 +
 sys/kern/kern_clock.c      |   2 +
 sys/kern/lwkt_thread.c     |  33 +--
 sys/kern/subr_sleepqueue.c | 513 +++++++++++++++++++++++++++++++++++++++++++++
 sys/sys/kernel.h           |   1 +
 sys/sys/param.h            |   2 +
 sys/sys/sleepqueue.h       | 127 +++++++++++
 sys/sys/thread.h           |  21 ++
 sys/sys/types.h            |   2 +
 9 files changed, 686 insertions(+), 16 deletions(-)
 create mode 100644 sys/kern/subr_sleepqueue.c
 create mode 100644 sys/sys/sleepqueue.h

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6d3dff5fd40db3cd5ce7d593596e39c85131215a


-- 
DragonFly BSD source repository


More information about the Commits mailing list