Monthly Archives: June 2010

Stupid SMP Tricks: Memory Barriers (RWC)

This posting relates to memory barriers in the Linux kernel. We start with smp_mb(), which is a full memory barrier when the kernel is built with CONFIG_SMP=y and is otherwise a compiler barrier that constrains compiler optimizations, but which generates … Continue reading

Posted in Uncategorized | Tagged | 9 Comments

Stupid SMP Tricks: Lockless Access to Structure

Suppose that a pointer is compile-time initialized to reference a static instance of a structure, perhaps as follows: struct foo { int a; int b; }; struct foo static_foo = { 42, 17 }; struct foo *foo_p = &static_foo; Because … Continue reading

Posted in Uncategorized | Tagged | Comments Off on Stupid SMP Tricks: Lockless Access to Structure

Stupid RCU Tricks: Synchronizing With External State

This puzzle came up at a recent ISO SC22 WG14 standards–committee meeting (for the C language). Suppose you have an array of three RCU-protected structures. At any given time, one of them is the current structure that will be used … Continue reading

Posted in Uncategorized | Tagged | 10 Comments