rcu

why does `synchronize_rcu()` not deadlock when beening called inside a read lock block?

安稳与你 提交于 2020-01-06 09:06:42
问题 synchronize_rcu() is used to waits only for ongoing RCU read-side critical sections to complete. If so, it should been blocked forever when beening called inside a read block. However, the following code works well on my linux kernel, why? void port_range_clean( void ) { struct port_range *p; redo: rcu_read_lock(); list_for_each_entry_rcu(p, &port_rt->ports, list) { list_del_rcu(&p->list); synchronize_rcu(); rcu_read_unlock(); kfree(p); goto redo; } } 来源: https://stackoverflow.com/questions

why does `synchronize_rcu()` not deadlock when beening called inside a read lock block?

删除回忆录丶 提交于 2020-01-06 09:05:21
问题 synchronize_rcu() is used to waits only for ongoing RCU read-side critical sections to complete. If so, it should been blocked forever when beening called inside a read block. However, the following code works well on my linux kernel, why? void port_range_clean( void ) { struct port_range *p; redo: rcu_read_lock(); list_for_each_entry_rcu(p, &port_rt->ports, list) { list_del_rcu(&p->list); synchronize_rcu(); rcu_read_unlock(); kfree(p); goto redo; } } 来源: https://stackoverflow.com/questions

Lock Free stack implementation idea - currently broken

微笑、不失礼 提交于 2019-12-11 06:19:46
问题 I came up with an idea I am trying to implement for a lock free stack that does not rely on reference counting to resolve the ABA problem, and also handles memory reclamation properly. It is similar in concept to RCU, and relies on two features: marking a list entry as removed, and tracking readers traversing the list. The former is simple, it just uses the LSB of the pointer. The latter is my "clever" attempt at an approach to implementing an unbounded lock free stack. Basically, when any