Reputation: 21
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 comes with write-lock
RCU can work on RCU, which means it creates a new RCU on the old RCU, waits for new RCU to finish and then the old RCU go to end of a grace period.
Which way is correct for Linux?
Upvotes: 2
Views: 765
Reputation: 5055
Just want to know if some new writer want to update the data during grace period, is it possible?
Yes, it is possible. Writer don't have to wait for a grace period to end. Also a grace period is significant for the reclamation stage (to put it simple, after removal we are waiting for readers who got access to the data (before our removal) to finish working with it and exit the critical section e.g. through rcu_read_unlock()
, then we can free it up).
Besides based on the fact that RCU supports concurrency between a single updater and multiple readers it's not so much a question of RCU. So if you have multiple updaters the appropriate locking should be applied.
Quite often RCU is used together with spinlocks to resolve concurrency between updaters. So you can see some clear examples of using RCU with multiple updaters in Linux Kernel source code.
Useful links:
Upvotes: 2