In Linux Kernel Development (3rd Edition), Kernel Synchronization Methods, Ordering and Barriers. There is an example:
And I'm confused about the statement in this book:
Again, without memory barriers, it would be possible for b to be set to pp before pp was set to p.
So, does the author mean if there is no read_barrier_depends()
, b = *pp
would be executed before pp = p
? How could this be possible?
I was interested in your problem, so I searched a bit longer. I found the post of the read_barrier_depends functionality on the kernel list, with some explanation: