Read-Copy-Update is a sync mechanism allowing reads to occur concurrently with updates. It maintains multiple versions of objects and ensures they aren't freed until all preexisting read-side crit-sections complete. Since write to aligned pointer is atomic, we can atomic insert, remove, replace data items in a linked struct without disrupting readers. Concurrent readers can then continue accessing the old version, new readers will see updated version.
Questions tagged [rcu]
52 questions
8
votes
1 answer
What does rcu_read_lock() actually do (Linux Kernel)
I'm trying to understand rcu_read_lock() synchronization mechanism. From what I understand, rcu_read_lock() is used, where there are several read threads and one write thread, that read/writes the same data, and reading is performed under…

Андрій Немченко
- 417
- 6
- 19
7
votes
1 answer
Linux RCU and double linked list
I'm reading about Read-copy-update (RCU). I'm not sure if I understood it correctly in case of SMP. As far as I know RCU ensures that Update is executed atomically. In case for example single linked list it is obvious that exchanging old element…

user2699113
- 4,262
- 3
- 25
- 43
7
votes
1 answer
RCU as an alternative to conventional garbage collection
Read-Copy-Update (RCU) is a technique for manual memory management that is growing ever more popular in the Linux kernel.
Is it possible to design a language and VM that uses RCU instead of a conventional garbage collector to reclaim unreachable…

J D
- 48,105
- 13
- 171
- 274
6
votes
3 answers
Is it necessary invoke rcu_read_lock in softirq context
The implement of rcu_read_lock is disable preempt and barrier. And the softirq context will not be preempted.
So is it necessary to invoke the rcu_read_lock in softirq context. Is the barrier important?

linuxer
- 326
- 4
- 14
4
votes
1 answer
Is it safe to use rcu_dereference() inside local_bh_disable()/local_bh_enable()?
The local_bh_disable-function changes per-cpu (in case of x86 and recent kernels) __preempt_count or current_thread_info()->preempt_count otherwise.
Anyway that gives us a grace period, so we can assume that it will be redundant to do…

red0ct
- 4,840
- 3
- 17
- 44
4
votes
2 answers
How RCU reader section is protected from preemption?
(From an article on LWN)
1 rcu_read_lock();
2 list_for_each_entry_rcu(p, head, list) {
3 do_something_with(p->a, p->b, p->c);
4 }
5 rcu_read_unlock();
The RCU update operation will do synchronize_rcu() in order to assert each CPU switched…

4pie0
- 29,204
- 9
- 82
- 118
3
votes
1 answer
ORA-12528, TNS:listener: all appropriate instances are blocking new connections
Hi when trying to create Repository Creation Utility by Data Connection details are not excepting.it throws the Exception is
Listener refused the connection with the following error:
ORA-12528, TNS:listener: all appropriate instances are blocking…

nag
- 647
- 6
- 25
- 43
3
votes
0 answers
delete all entries from concurrent hashmap in linux kernel
I'm writing a kernel module, that uses a module-wide hashmap to store connections. I want to release all these connections, when the module is unloaded, delete them from the hashmap and then delete the whole map.
I defined the hashmap:
#define…

kaidowei
- 105
- 1
- 9
2
votes
1 answer
Nesting of rcu_read_locks
I store a RCU protected pointer MyStruct *, in a RCU protected hashtable MyHash. When reading/updating MyStruct via hashtable, I do as shown below.
rcu_read_lock() /* For hashtable 'MyHash' */
hash_for_each_possible_rcu(MyHash, obj, member, key)
{
…

Shyam
- 453
- 3
- 13
2
votes
1 answer
For Linux RCU, during the grace period, is it possible that a new writer update the new data?
I am new to Linux and studying RCU section. I saw there is a grace period during operation. Just want to know if some new writer want to update the data during a grace period, is it possible? I guess there are two ways:
During a grace period, it…

Chung Hao Ho
- 21
- 3
2
votes
1 answer
Why does list_add_rcu only protect "prev->next"?
Following is the implementation of __list_add_rcu in include/linux/rculist.h:
static inline void __list_add_rcu(struct list_head *new,
struct list_head *prev, struct list_head *next)
{
new->next = next;
new->prev = prev;
…

Yan Zhu
- 4,036
- 3
- 21
- 37
2
votes
1 answer
Does hlist_for_each_entry_rcu need additional pointer to be passed into it?
LWN gives the following example on RCU:
Subscribing to an RCU-protected hlist is also similar to the circular
list:
1 rcu_read_lock();
2 hlist_for_each_entry_rcu(p, q, head, list) {
3 do_something_with(p->a, p->b, p->c);
4 }
5…

4pie0
- 29,204
- 9
- 82
- 118
2
votes
0 answers
spin_lock_irqsave and alloc inside rcu_read_lock
Hi,
I have a driver code which is supposed to work on certain packets received on the interface.The driver uses spin_lock_irqsave to manage parallel such requests before giving it to the hardware.
To work on the packet, it requires some context…

CodeQ
- 319
- 1
- 3
- 13
1
vote
0 answers
rcu_sched kthread timer wakeup didn't happen for x jiffies Allwinner sun8i
I'm working on my own distribution for OrangePI R1 with Allwinner sun8i SoC. I had stripped kernel_defconfig to fit my custom linux into 16M SPI NOR. After leaving the board up for few days I see such messages on my serial…

BlameCapitalism
- 63
- 8
1
vote
1 answer
Race conditions due to speculative reordering / Linux RCU facility
The following excerpt is taken from the website https://lwn.net/Articles/262464/ and it is dealing with read-inconsistencies of shared data structures (for which there was the RCU created):
p = gp;
if (p != NULL) {
do_something_with(p->a, p->b,…

Vroomfondel
- 2,704
- 1
- 15
- 29