|
|
|
|
|
by haberman
3961 days ago
|
|
I don't think that works. You can't get a consistent view of the counters without a lock. Consider the following scenario: CPU1 CPU2
---- ----
T1 rcu_read_lock (+1)
read counter (0)
T2 rcu_read_lock (+1)
T2 rcu_read_unlock (-1)
read counter (0)
We'll find that zero is the sum of all counters, even though T1 is still in its read lock. |
|
If there were a nice way to swap out the counters then summing would work, unfortunately that introduces an even bigger race :-(
Thanks for the correction!