分类: LINUX
2008-08-02 21:52:09
定义在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} |
最终会调用linux/include/asm-i386/percpu.h 70#define __raw_get_cpu_var(var) (*({ \ 71 extern int simple_indentifier_##var(void); \ 72 RELOC_HIDE(&per_cpu__##var, x86_read_percpu(this_cpu_off)); 其中 RELOC_HIDE宏定义如下: # define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ __ptr = (unsigned long) (ptr); \ (typeof(ptr)) (__ptr + (off)); }) |
520void rcu_check_callbacks(int cpu, int user) 521{ 522 if (user || 523 (idle_cpu(cpu) && !in_softirq() && 524 hardirq_count() <= (1 << HARDIRQ_SHIFT))) { 525 rcu_qsctr_inc(cpu); 526 rcu_bh_qsctr_inc(cpu); 527 } else if (!in_softirq()) 528 rcu_bh_qsctr_inc(cpu); 529 tasklet_schedule(&per_cpu(rcu_tasklet, cpu)); 530} |