Skip to content

Commit 1143c9d

Browse files
sjp38tehcaster
authored andcommitted
mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
The SLAB_TYPESAFE_BY_RCU example code snippet uses a single RCU read-side critical section for retries. 'Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commit da82af0 ("doc: Update and wordsmith rculist_nulls.rst") broke it up. Apply the change to SLAB_TYPESAFE_BY_RCU example code snippet, too. Signed-off-by: SeongJae Park <[email protected]> Reviewed-by: Paul E. McKenney <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 9ca73f2 commit 1143c9d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/linux/slab.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,18 @@
5353
* stays valid, the trick to using this is relying on an independent
5454
* object validation pass. Something like:
5555
*
56+
* begin:
5657
* rcu_read_lock();
57-
* again:
5858
* obj = lockless_lookup(key);
5959
* if (obj) {
6060
* if (!try_get_ref(obj)) // might fail for free objects
61-
* goto again;
61+
* rcu_read_unlock();
62+
* goto begin;
6263
*
6364
* if (obj->key != key) { // not the object we expected
6465
* put_ref(obj);
65-
* goto again;
66+
* rcu_read_unlock();
67+
* goto begin;
6668
* }
6769
* }
6870
* rcu_read_unlock();

0 commit comments

Comments
 (0)