static inline void __list_add_rcu(struct list_head * new,
struct list_head * prev, struct list_head * next)
{
new->next = next;
new->prev = prev;
smp_wmb();
next->prev = new;
prev->next = new;
}
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
smp_wmb()防止编译器和CPU优化代码执行的顺序。在这里,smp_wmb保证在它之前的两行代码执行完了之后再
执行后两行.如果没有smp_wmb,代码在CPU中执行的顺序可能和源代码里的不一样!
阅读(4871) | 评论(0) | 转发(0) |