tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __{read,write}_once

> Date: Wed, 6 Nov 2019 12:31:37 +0100
> From: Maxime Villard <>
> 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 [1] about
> this, and also [2]. I'd like to introduce the following macros:
> 	__read_once(x)
> 	__write_once(x, val)

This thread is not converging on consensus, so we're discussing the
semantics and naming of these operations as core and will come back
with a decision by the end of the week.

-Riastradh, on behalf of core

Home | Main Index | Thread Index | Old Index