You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the reader_func is counting the number of grace periods based
on the value of dut, which is updated by rcu_assign_pointer. However,
the value of dut actually represents the time we update the value, not
the number of grace periods.
Also, the original method might result in incorrect counting if someone
tried to update the gp_idx while others who saw the same dut value with
prev_count still depend on the old gp_idx to increase the counter.
To fix the problem, instead of relying on the dut value to increase the
gp_idx, we manually increase gp_idx on write side. Then, we can easily
determine the gp on read side.
For dut value, we simply check the old count value is not greater than
the newest one.
Additionally, since synchronize_rcu is quite slow, readers generally
will pass through the critical section during the first grace period.
To generate more realistic output, we add a delay on read side before
entering the critical section.
Before:
100 reader(s), 5 update run(s), 6 grace period(s)
[grace period #0] 100 reader(s)
[grace period #1] 0 reader(s)
[grace period #2] 0 reader(s)
[grace period #3] 0 reader(s)
[grace period #4] 0 reader(s)
[grace period #5] 0 reader(s)
After, we added a delay:
100 reader(s), 5 update run(s), 6 grace period(s)
[grace period #0] 76 reader(s)
[grace period #1] 0 reader(s)
[grace period #2] 1 reader(s)
[grace period #3] 0 reader(s)
[grace period #4] 3 reader(s)
[grace period #5] 20 reader(s)
0 commit comments