Skip to content

Commit d186204

Browse files
sjp38paulmckrcu
authored andcommitted
Docs/RCU/rculist_nulls: Fix hlist_[nulls]_head field names of 'obj'
The example code snippets on rculist_nulls.rst are assuming 'obj' to have the 'hlist_head' or 'hlist_nulls_head' field named 'obj_node', but a sentence and some code snippets are wrongly calling 'obj->obj_node.next' as 'obj->obj_next', or 'obj->obj_node' as 'member'. Fix it. Signed-off-by: SeongJae Park <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 5326caa commit d186204

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Documentation/RCU/rculist_nulls.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ but a version with an additional memory barrier (smp_rmb())
6565
struct hlist_node *node, *next;
6666
for (pos = rcu_dereference((head)->first);
6767
pos && ({ next = pos->next; smp_rmb(); prefetch(next); 1; }) &&
68-
({ obj = hlist_entry(pos, typeof(*obj), member); 1; });
68+
({ obj = hlist_entry(pos, typeof(*obj), obj_node); 1; });
6969
pos = rcu_dereference(next))
7070
if (obj->key == key)
7171
return obj;
@@ -77,7 +77,7 @@ And note the traditional hlist_for_each_entry_rcu() misses this smp_rmb()::
7777
struct hlist_node *node;
7878
for (pos = rcu_dereference((head)->first);
7979
pos && ({ prefetch(pos->next); 1; }) &&
80-
({ obj = hlist_entry(pos, typeof(*obj), member); 1; });
80+
({ obj = hlist_entry(pos, typeof(*obj), obj_node); 1; });
8181
pos = rcu_dereference(pos->next))
8282
if (obj->key == key)
8383
return obj;
@@ -97,7 +97,7 @@ Quoting Corey Minyard::
9797
2) Insertion algorithm
9898
----------------------
9999

100-
We need to make sure a reader cannot read the new 'obj->obj_next' value
100+
We need to make sure a reader cannot read the new 'obj->obj_node.next' value
101101
and previous value of 'obj->key'. Otherwise, an item could be deleted
102102
from a chain, and inserted into another chain. If new chain was empty
103103
before the move, 'next' pointer is NULL, and lockless reader can not
@@ -165,7 +165,7 @@ Note that using hlist_nulls means the type of 'obj_node' field of
165165
head = &table[slot];
166166
begin:
167167
rcu_read_lock();
168-
hlist_nulls_for_each_entry_rcu(obj, node, head, member) {
168+
hlist_nulls_for_each_entry_rcu(obj, node, head, obj_node) {
169169
if (obj->key == key) {
170170
if (!try_get_ref(obj)) { // might fail for free objects
171171
rcu_read_unlock();

0 commit comments

Comments
 (0)