Message ID | 20230613182434.88317-4-sj@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Docs/RCU/rculist_nulls: Minor fixups | expand |
On Tue, Jun 13, 2023 at 06:24:33PM +0000, SeongJae Park wrote: > The example code snippets on rculist_nulls.rst are assuming 'obj' to > have the 'hlist_head' field named 'obj_node', but a sentence is wrongly > mentioning 'obj->obj_node.next' as 'obj->obj_next'. Fix it. > > Signed-off-by: SeongJae Park <sj@kernel.org> > Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> > --- > Documentation/RCU/rculist_nulls.rst | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst > index 94a8bfe9f560..5cd6f3f8810f 100644 > --- a/Documentation/RCU/rculist_nulls.rst > +++ b/Documentation/RCU/rculist_nulls.rst > @@ -86,7 +86,7 @@ Quoting Corey Minyard:: > 2) Insertion algorithm > ---------------------- > > -We need to make sure a reader cannot read the new 'obj->obj_next' value > +We need to make sure a reader cannot read the new 'obj->obj_node.next' value I do like this being more specific, but if we are going do add this level of specificity, shouldn't we refer to a definition of ->obj_node? (I queued and pushed 1/4 and 2/4, thank you, and stopped here.) Thanx, Paul > and previous value of 'obj->key'. Otherwise, an item could be deleted > from a chain, and inserted into another chain. If new chain was empty > before the move, 'next' pointer is NULL, and lockless reader can not > -- > 2.25.1 >
On Wed, 14 Jun 2023 09:36:50 -0700 "Paul E. McKenney" <paulmck@kernel.org> wrote: > On Tue, Jun 13, 2023 at 06:24:33PM +0000, SeongJae Park wrote: > > The example code snippets on rculist_nulls.rst are assuming 'obj' to > > have the 'hlist_head' field named 'obj_node', but a sentence is wrongly > > mentioning 'obj->obj_node.next' as 'obj->obj_next'. Fix it. > > > > Signed-off-by: SeongJae Park <sj@kernel.org> > > Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> > > --- > > Documentation/RCU/rculist_nulls.rst | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst > > index 94a8bfe9f560..5cd6f3f8810f 100644 > > --- a/Documentation/RCU/rculist_nulls.rst > > +++ b/Documentation/RCU/rculist_nulls.rst > > @@ -86,7 +86,7 @@ Quoting Corey Minyard:: > > 2) Insertion algorithm > > ---------------------- > > > > -We need to make sure a reader cannot read the new 'obj->obj_next' value > > +We need to make sure a reader cannot read the new 'obj->obj_node.next' value > > I do like this being more specific, but if we are going do add this > level of specificity, shouldn't we refer to a definition of ->obj_node? Agreed, I will add the example definition in the next spin. I also found we would better to further fix wrong 'member' field assumption, like below: - ({ obj = hlist_entry(pos, typeof(*obj), member); 1; }); + ({ obj = hlist_entry(pos, typeof(*obj), obj_node); 1; }); Thanks, SJ > > (I queued and pushed 1/4 and 2/4, thank you, and stopped here.) > > Thanx, Paul > > > and previous value of 'obj->key'. Otherwise, an item could be deleted > > from a chain, and inserted into another chain. If new chain was empty > > before the move, 'next' pointer is NULL, and lockless reader can not > > -- > > 2.25.1 > > >
diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 94a8bfe9f560..5cd6f3f8810f 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -86,7 +86,7 @@ Quoting Corey Minyard:: 2) Insertion algorithm ---------------------- -We need to make sure a reader cannot read the new 'obj->obj_next' value +We need to make sure a reader cannot read the new 'obj->obj_node.next' value and previous value of 'obj->key'. Otherwise, an item could be deleted from a chain, and inserted into another chain. If new chain was empty before the move, 'next' pointer is NULL, and lockless reader can not