brintos

brintos / linux-shallow public Read only

0
0
Text · 704 B · f341767 Raw
38 lines · plain
1C RCU+sync+read2 3(*4 * Result: Never5 *6 * This litmus test demonstrates that after a grace period, an RCU updater always7 * sees all stores done in prior RCU read-side critical sections. Such8 * read-side critical sections would have ended before the grace period ended.9 *10 * This is one implication of the RCU grace-period guarantee, which says (among11 * other things) that an RCU read-side critical section cannot span a grace period.12 *)13 14{15int x = 0;16int y = 0;17}18 19P0(int *x, int *y)20{21	rcu_read_lock();22	WRITE_ONCE(*x, 1);23	WRITE_ONCE(*y, 1);24	rcu_read_unlock();25}26 27P1(int *x, int *y)28{29	int r0;30	int r1;31 32	r0 = READ_ONCE(*x);33	synchronize_rcu();34	r1 = READ_ONCE(*y);35}36 37exists (1:r0=1 /\ 1:r1=0)38