diff mbox series

subflow: remove unneded memory barriers

Message ID 20200114231949.20106-1-fw@strlen.de
State Accepted, archived
Delegated to: Matthieu Baerts
Headers show
Series subflow: remove unneded memory barriers | expand

Commit Message

Florian Westphal Jan. 14, 2020, 11:19 p.m. UTC
squashto: mptcp: Implement MPTCP receive path

The bit set operation has no prior dependencies, so
smp_mb__before_atomic() is not needed.

It has no followup depenency: the woken task will always see the
bit set, plus wakeup code (called via sk_data_ready) acquires a spinlock.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/mptcp/subflow.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Mat Martineau Jan. 15, 2020, 1:34 a.m. UTC | #1
On Wed, 15 Jan 2020, Florian Westphal wrote:

> squashto: mptcp: Implement MPTCP receive path
>
> The bit set operation has no prior dependencies, so
> smp_mb__before_atomic() is not needed.
>
> It has no followup depenency: the woken task will always see the
> bit set, plus wakeup code (called via sk_data_ready) acquires a spinlock.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> net/mptcp/subflow.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index abd97d1a8645..ae9173040f17 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -712,9 +712,7 @@ static void subflow_data_ready(struct sock *sk)
> 	}
>
> 	if (mptcp_subflow_data_available(sk)) {
> -		smp_mb__before_atomic();
> 		set_bit(MPTCP_DATA_READY, &mptcp_sk(parent)->flags);
> -		smp_mb__after_atomic();
>
> 		parent->sk_data_ready(parent);
> 	}
> @@ -869,9 +867,7 @@ static void subflow_state_change(struct sock *sk)
> 	 * the data available machinery here.
> 	 */
> 	if (parent && subflow->mp_capable && mptcp_subflow_data_available(sk)) {
> -		smp_mb__before_atomic();
> 		set_bit(MPTCP_DATA_READY, &mptcp_sk(parent)->flags);
> -		smp_mb__after_atomic();
>
> 		parent->sk_data_ready(parent);
> 	}
> -- 
> 2.24.1

I agree that these barriers are not needed.

--
Mat Martineau
Intel
Matthieu Baerts Jan. 16, 2020, 4:50 p.m. UTC | #2
Hi Florian, Mat,

On 15/01/2020 02:34, Mat Martineau wrote:
> On Wed, 15 Jan 2020, Florian Westphal wrote:
> 
>> squashto: mptcp: Implement MPTCP receive path
>>
>> The bit set operation has no prior dependencies, so
>> smp_mb__before_atomic() is not needed.
>>
>> It has no followup depenency: the woken task will always see the
>> bit set, plus wakeup code (called via sk_data_ready) acquires a spinlock.

[...]

> I agree that these barriers are not needed.

Thank you for the patch and the review!

- 53f6baf4672c: "squashed" in "mptcp: Implement MPTCP receive path"
- 41b3253570a8..91800c0574b2: result

Tests + export will be launched soon!

Cheers,
Matt
diff mbox series

Patch

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index abd97d1a8645..ae9173040f17 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -712,9 +712,7 @@  static void subflow_data_ready(struct sock *sk)
 	}
 
 	if (mptcp_subflow_data_available(sk)) {
-		smp_mb__before_atomic();
 		set_bit(MPTCP_DATA_READY, &mptcp_sk(parent)->flags);
-		smp_mb__after_atomic();
 
 		parent->sk_data_ready(parent);
 	}
@@ -869,9 +867,7 @@  static void subflow_state_change(struct sock *sk)
 	 * the data available machinery here.
 	 */
 	if (parent && subflow->mp_capable && mptcp_subflow_data_available(sk)) {
-		smp_mb__before_atomic();
 		set_bit(MPTCP_DATA_READY, &mptcp_sk(parent)->flags);
-		smp_mb__after_atomic();
 
 		parent->sk_data_ready(parent);
 	}