netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: consolidate local_bh_disable/enable + spin_lock/unlock to _bh variant
@ 2016-03-13 10:48 Nicholas Mc Guire
  2016-03-15 18:03 ` Marcelo Ricardo Leitner
  2016-03-16 23:21 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2016-03-13 10:48 UTC (permalink / raw)
  To: Vlad Yasevich
  Cc: wangweidong, Neil Horman, David S. Miller, linux-sctp, netdev,
	linux-kernel, Nicholas Mc Guire

local_bh_disable() + spin_lock() is equivalent to spin_lock_bh(), same for
the unlock/enable case, so replace the calls by the appropriate wrappers.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

net-next 3c8e43ba "sctp: remove macros sctp_spin_[un]lock" and
net-next 79b91130 "sctp: remove macros sctp_local_bh_{disable|enable}"
reverted scpt macros back to spin_lock/unlock and local_bh_disable/enable
which can be consolidated to spin_lock_bh/spin_unlock_bh in this case.

Compile tested with: x86_64_defconfig + CONFIG_IP_SCTP=m

Patch is against linux-next (localversion-next is next-20160311)

 net/sctp/socket.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index b2dc8eb..f62feb0 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -7256,14 +7256,12 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
 	/* Hook this new socket in to the bind_hash list. */
 	head = &sctp_port_hashtable[sctp_phashfn(sock_net(oldsk),
 						 inet_sk(oldsk)->inet_num)];
-	local_bh_disable();
-	spin_lock(&head->lock);
+	spin_lock_bh(&head->lock);
 	pp = sctp_sk(oldsk)->bind_hash;
 	sk_add_bind_node(newsk, &pp->owner);
 	sctp_sk(newsk)->bind_hash = pp;
 	inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num;
-	spin_unlock(&head->lock);
-	local_bh_enable();
+	spin_unlock_bh(&head->lock);
 
 	/* Copy the bind_addr list from the original endpoint to the new
 	 * endpoint so that we can handle restarts properly
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sctp: consolidate local_bh_disable/enable + spin_lock/unlock to _bh variant
  2016-03-13 10:48 [PATCH] sctp: consolidate local_bh_disable/enable + spin_lock/unlock to _bh variant Nicholas Mc Guire
@ 2016-03-15 18:03 ` Marcelo Ricardo Leitner
  2016-03-16 23:21 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2016-03-15 18:03 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Vlad Yasevich, wangweidong, Neil Horman, David S. Miller,
	linux-sctp, netdev, linux-kernel

On Sun, Mar 13, 2016 at 11:48:24AM +0100, Nicholas Mc Guire wrote:
> local_bh_disable() + spin_lock() is equivalent to spin_lock_bh(), same for
> the unlock/enable case, so replace the calls by the appropriate wrappers.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
> 
> net-next 3c8e43ba "sctp: remove macros sctp_spin_[un]lock" and
> net-next 79b91130 "sctp: remove macros sctp_local_bh_{disable|enable}"
> reverted scpt macros back to spin_lock/unlock and local_bh_disable/enable
> which can be consolidated to spin_lock_bh/spin_unlock_bh in this case.
> 
> Compile tested with: x86_64_defconfig + CONFIG_IP_SCTP=m
> 
> Patch is against linux-next (localversion-next is next-20160311)
> 
>  net/sctp/socket.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index b2dc8eb..f62feb0 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -7256,14 +7256,12 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
>  	/* Hook this new socket in to the bind_hash list. */
>  	head = &sctp_port_hashtable[sctp_phashfn(sock_net(oldsk),
>  						 inet_sk(oldsk)->inet_num)];
> -	local_bh_disable();
> -	spin_lock(&head->lock);
> +	spin_lock_bh(&head->lock);
>  	pp = sctp_sk(oldsk)->bind_hash;
>  	sk_add_bind_node(newsk, &pp->owner);
>  	sctp_sk(newsk)->bind_hash = pp;
>  	inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num;
> -	spin_unlock(&head->lock);
> -	local_bh_enable();
> +	spin_unlock_bh(&head->lock);
>  
>  	/* Copy the bind_addr list from the original endpoint to the new
>  	 * endpoint so that we can handle restarts properly
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sctp: consolidate local_bh_disable/enable + spin_lock/unlock to _bh variant
  2016-03-13 10:48 [PATCH] sctp: consolidate local_bh_disable/enable + spin_lock/unlock to _bh variant Nicholas Mc Guire
  2016-03-15 18:03 ` Marcelo Ricardo Leitner
@ 2016-03-16 23:21 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-03-16 23:21 UTC (permalink / raw)
  To: hofrat; +Cc: vyasevich, wangweidong1, nhorman, linux-sctp, netdev,
	linux-kernel

From: Nicholas Mc Guire <hofrat@osadl.org>
Date: Sun, 13 Mar 2016 11:48:24 +0100

> local_bh_disable() + spin_lock() is equivalent to spin_lock_bh(), same for
> the unlock/enable case, so replace the calls by the appropriate wrappers.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-16 23:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-13 10:48 [PATCH] sctp: consolidate local_bh_disable/enable + spin_lock/unlock to _bh variant Nicholas Mc Guire
2016-03-15 18:03 ` Marcelo Ricardo Leitner
2016-03-16 23:21 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).