Page MenuHomeFreeBSD

wg_noise: Remove atomics for kp pointers.
Needs ReviewPublic

Authored by jhb on Fri, Jul 29, 4:57 PM.

Details

Reviewers
markj
Summary

Atomics are not needed to read the pointers inside of an epoch
due to fences in epoch_*.

Almost all other accesses were under a mutex.

There is one unlocked read of the pointer for which the atomic
load doesn't do anything (in terms of limiting races).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 46683
Build 43572: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Fri, Jul 29, 4:57 PM

There is one unlocked read of the pointer for which the atomic load doesn't do anything (in terms of limiting races).

Does it make sense for this case to have a comment (i.e., explaining why the race is not important)?

sys/dev/wg/wg_noise.c
730

This is the unlocked read and it's just an optimization to avoid the lock below (and not an uncommon pattern, so I think it is obvious in context)

sys/dev/wg/wg_noise.c
730

Fair enough, I did not look at each case to find the unlocked read and when pointed out in context it's clear enough to me. [That said I don't think a comment wouldn't be out of place]