-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A few memory accesses don't seem correct to me, and a few seem slightly stricter than necessary. Here are the rules in userspace, I think: sq.ktail is read by the kernel sq.khead is written by the kernel cq.ktail is written by the kernel cq.khead is read by the kernel Locations that are written concurrently by the kernel must be loaded atomically; if they specify (to the user) that some memory is now available, they must be loaded with acquire semantics before the memory is read. Similarly, locations that are read concurrently by the kernel must be written atomically; if they specify (to the kernel) that some memory is now available, they must be stored with release semantics after the memory is written to. Note that without SQPOLL, sq is only accessed by the kernel in response to a system call, so no synchronization is necessary. Note that in practice, on most CPU architectures, a regular aligned load/store is already atomic; in that situation READ_ONCE/WRITE_ONCE is primarily necessary for the compiler, which would otherwise be allowed to do invalid things like load the lower half of an integer and then the upper half. Signed-off-by: Shachaf Ben-Kiki <[email protected]>
- Loading branch information
Showing
3 changed files
with
20 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters