lkml.org 
[lkml]   [2006]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Document Linux's memory barriers [try #4]
David Howells writes:

> + CPU 1 CPU 2 COMMENT
> + =============== =============== =======================================
> + a == 0, b == 1 and p == &a, q == &a
> + b = 2;
> + smp_wmb(); Make sure b is changed before p
> + p = &b; q = p;
> + d = *q;
> +
> +then old data values may be used in the address calculation for the second
> +value, potentially resulting in q == &b and d == 0 being seen, which is never
> +correct. What is required is a data dependency memory barrier:

No, that's not the problem. The problem is that you can get q == &b
and d == 1, believe it or not. That is, you can see the new value of
the pointer but the old value of the thing pointed to.

Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-14 22:50    [W:0.064 / U:1.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site