|
|
|
|
|
|
|
|
|
113 DECLARE_PER_CPU(struct rcu_data, rcu_data); 114 DECLARE_PER_CPU(struct rcu_data, rcu_bh_data); 该结构在SMP定义每个CPU私有数据, #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name 其中__typeof__(type)是取type的类型。你上面的定义: DECLARE_PER_CPU(struct rcu_data, rcu_data); 实际上相当于: extern struct rcu_data per_cpu__rcu_data; 通过 struct rcu_head { struct rcu_head *next; void (*func)(struct rcu_head *head); }; 该结构构成每个CPU私有数据回调函数链表。具体调用过程通过call_rcu()函数实现的。
定义在linux/kernel/rcupdate.c定义: 117void fastcall call_rcu(struct rcu_head *head, 118 void (*func)(struct rcu_head *rcu)) 119{ 120 unsigned long flags; 121 struct rcu_data *rdp; 122 123 head->func = func; 124 head->next = NULL; 125 local_irq_save(flags); 126 rdp = &__get_cpu_var(rcu_data); 127 *rdp->nxttail = head; 128 rdp->nxttail = &head->next; 129 if (unlikely(++rdp->qlen > qhimark)) { 130 rdp->blimit = INT_MAX; 131 force_quiescent_state(rdp, &rcu_ctrlblk); 132 } 133 local_irq_restore(flags); 134} |
| |
| |
|
|
|
|
|
|
|
|
|