Simple_implementation Read-copy-update
in code sample, rcu_assign_pointer , rcu_dereference can ignored without missing much. however, provided below.
note rcu_read_lock , rcu_read_unlock nothing. great strength of classic rcu in non-preemptive kernel: read-side overhead precisely zero, smp_read_barrier_depends() empty macro on dec alpha cpus; such memory barriers not needed on modern cpus. access_once() macro volatile cast generates no additional code in cases. , there no way rcu_read_lock can participate in deadlock cycle, cause realtime process miss scheduling deadline, precipitate priority inversion, or result in high lock contention. however, in toy rcu implementation, blocking within rcu read-side critical section illegal, blocking while holding pure spinlock.
the implementation of synchronize_rcu moves caller of synchronize_cpu each cpu, blocking until cpus have been able perform context switch. recall non-preemptive environment , blocking within rcu read-side critical section illegal, imply there can no preemption points within rcu read-side critical section. therefore, if given cpu executes context switch (to schedule process), know cpu must have completed preceding rcu read-side critical sections. once cpus have executed context switch, preceding rcu read-side critical sections have completed.
Comments
Post a Comment