git: kernel - Cleanup token code, add simple exclusive priority (2)

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Oct 21 15:14:22 PDT 2017


commit 5042f74dda34ca4cca002c8a21288262a96ad756
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat Oct 21 15:02:05 2017 -0700

    kernel - Cleanup token code, add simple exclusive priority (2)
    
    * The priority mechanism revealed an issue with lwkt_switch()'s
      fall-back code in dealing with contended tokens.  The code was
      refusing to schedule a lower-priority thread on a cpu requesting an
      exclusive lock as another on that same cpu requesting a shared lock.
    
      This creates a problem for the exclusive priority feature.  More
      pointedly, it also creates a fairness problem in the mixed lock
      type use case generally.
    
    * Change the mechanism to allow any thread polling on tokens to be
      scheduled.  The scheduler will still iterate in priority order.
      This imposes a little extra overhead with regards to userspace
      returns as a thread might be scheduled that then tries to return
      to userland without being the designated user thread.
    
    * This also fixes another bug that cropped up recently where a
      32-way threaded program would sometimes not quickly schedule to
      all 32 cpus, sometimes leaving one or two cpus idle for a few
      seconds.

Summary of changes:
 sys/kern/lwkt_thread.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/5042f74dda34ca4cca002c8a21288262a96ad756


-- 
DragonFly BSD source repository


More information about the Commits mailing list