• Paul E. McKenney's avatar
    locktorture: Count lock readers · af5f6e27
    Paul E. McKenney authored
    Currently, the lock_is_read_held variable is bool, so that a reader sets
    it to true just after lock acquisition and then to false just before
    lock release.  This works in a rough statistical sense, but can result
    in false negatives just after one of a pair of concurrent readers has
    released the lock.  This approach does have low overhead, but at the
    expense of the setting to true potentially never leaving the reader's
    store buffer, thus resulting in an unconditional false negative.
    
    This commit therefore converts this variable to atomic_t and makes
    the reader use atomic_inc() just after acquisition and atomic_dec()
    just before release.  This does increase overhead, but this increase is
    negligible compared to the 10-microsecond lock hold time.
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    af5f6e27
locktorture.c 29.4 KB