[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
There are cases in the kernel where we read/write global memory locklessly,
and accept the races either because it is part of the design (eg low-level
scheduling) or we simply don't care (eg global stats).
In these cases, we want to access the memory only once, and need to ensure
the compiler does not split that access in several pieces, some of which
may be changed by concurrent accesses. There is a Linux article  about
this, and also . I'd like to introduce the following macros:
- Are supposed to ensure that reads/writes result in only one access. We
basically just cast to volatile for now.
- Serve as markers for KCSAN, to say "yes there is a race, but it's
expected and you don't need to care".
- Help understanding the code, ie the reader will easily see that the area
can legitimately race.
In short, the main role they play is markers, to inform the reader and
I've made a patch , with several changes already to use these macros.
Feel free to comment
Main Index |
Thread Index |