diff mbox series

[v3,1/6] list: Don't use WRITE_ONCE() in hlist_add_behind()

Message ID 20190317122258.21760-2-ntsironis@arrikto.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm snapshot: Improve performance using a more fine-grained locking scheme | expand

Commit Message

Nikos Tsironis March 17, 2019, 12:22 p.m. UTC
Commit 1c97be677f72b3 ("list: Use WRITE_ONCE() when adding to lists and
hlists") introduced the use of WRITE_ONCE() to atomically write the list
head's ->next pointer.

hlist_add_behind() doesn't touch the hlist head's ->first pointer so
there is no reason to use WRITE_ONCE() in this case.

Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Ilias Tsitsimpis <iliastsi@arrikto.com>
---
 include/linux/list.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul E. McKenney March 18, 2019, 3:39 p.m. UTC | #1
On Sun, Mar 17, 2019 at 02:22:53PM +0200, Nikos Tsironis wrote:
> Commit 1c97be677f72b3 ("list: Use WRITE_ONCE() when adding to lists and
> hlists") introduced the use of WRITE_ONCE() to atomically write the list
> head's ->next pointer.
> 
> hlist_add_behind() doesn't touch the hlist head's ->first pointer so
> there is no reason to use WRITE_ONCE() in this case.
> 
> Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
> Signed-off-by: Ilias Tsitsimpis <iliastsi@arrikto.com>

Reviewed-by: Paul E. McKenney <paulmck@linux.ibm.com>

> ---
>  include/linux/list.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/list.h b/include/linux/list.h
> index edb7628e46ed..b68d2a85859b 100644
> --- a/include/linux/list.h
> +++ b/include/linux/list.h
> @@ -743,7 +743,7 @@ static inline void hlist_add_behind(struct hlist_node *n,
>  				    struct hlist_node *prev)
>  {
>  	n->next = prev->next;
> -	WRITE_ONCE(prev->next, n);
> +	prev->next = n;
>  	n->pprev = &prev->next;
>  
>  	if (n->next)
> -- 
> 2.11.0
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/include/linux/list.h b/include/linux/list.h
index edb7628e46ed..b68d2a85859b 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -743,7 +743,7 @@  static inline void hlist_add_behind(struct hlist_node *n,
 				    struct hlist_node *prev)
 {
 	n->next = prev->next;
-	WRITE_ONCE(prev->next, n);
+	prev->next = n;
 	n->pprev = &prev->next;
 
 	if (n->next)