Question

I am new to Linux kernel programming. I am confused by the memory barriers documentation, in the GUARANTEES chapter.

Overlapping loads and stores within a particular CPU will appear to be ordered within that CPU.

*X = c; d = *X;

the CPU will only issue:

STORE *X = c, d = LOAD *X

And then another example after that:

It must be assumed that overlapping memory accesses may be merged or discarded.

*A = X; Y = *A;

we may get either of:

STORE *A = X; Y = LOAD *A;
STORE *A = Y = X;

They look like the same, what's the difference between the two examples?

Était-ce utile?

La solution

You are right, the documnetation is not correct. Actually your version of the file isn't up to date. There have been a commit in 3.8-rc3 which fixed the issue: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=f191eec58803e1e16c3421638cdcc9195c425851

Hope that helps. Matthias

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top