SVNews r327478

NOTE: This service is experimental and subject to change! Use at your own risk!

2018-01-02 00:02:36 - r327478 by mjg (Mateusz Guzik)

Complete list of files affected by revision r327478:

(Note: At the moment, these links point to ViewVC on svn.freebsd.org. They are probably slow. Do not overuse.)

   Contents     MODIFY   /stable/11  
  History   Contents   Diff   MODIFY   /stable/11/sys/kern/kern_rwlock.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/kern/kern_sx.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/sys/lock.h  

Commit message:

MFC r324335,r327393,r327397,r327401,r327402:

  locks: take the number of readers into account when waiting

  Previous code would always spin once before checking the lock. But a lock
  with e.g. 6 readers is not going to become free in the duration of once spin
  even if they start draining immediately.

  Conservatively perform one for each reader.

  Note that the total number of allowed spins is still extremely small and is
  subject to change later.

=============

  rwlock: tidy up __rw_runlock_hard similarly to r325921

=============

  sx: read the SX_NOADAPTIVE flag and Giant ownership only once

  These used to be read multiple times when waiting for the lock the become
  free, which had the potential to issue completely avoidable traffic.

=============

  locks: re-check the reason to go to sleep after locking sleepq/turnstile

  In both rw and sx locks we always go to sleep if the lock owner is not
  running.

  We do spin for some time if the lock is read-locked.

  However, if we decide to go to sleep due to the lock owner being off cpu
  and after sleepq/turnstile gets acquired the lock is read-locked, we should
  fallback to the aforementioned wait.

=============

  sx: fix up non-smp compilation after r327397

=============

  locks: adjust loop limit check when waiting for readers

  The check was for the exact value, but since the counter started being
  incremented by the number of readers it could have jumped over.

=============

  Return a non-NULL owner only if the lock is exclusively held in owner_sx().

  Fix some whitespace bugs while here.

 


Powered by Python FreeBSD support by secnetix GmbH & Co. KG

Page generated in 2 ms, 4 files printed. Current time is 2018-04-20 06:57:07. All times are in UTC/GMT.