Skip to contentSkip to conversation

subflow: remove unneded memory barriers

PATCH In review Florian Westphal 3 participants 3 messages Jan 14, 2020 – Jan 16, 2020

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author
#0 lore raw

PATCH 1/1 subflow: remove unneded memory barriers

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(a)strlen.de>
---
 net/mptcp/subflow.c | 4 ----
 1 file changed, 4 deletions(-)
net/mptcp/subflow.c +0 -4
index abd97d1a8645..ae9173040f17 100644
@@ -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);
 	}
Signature · 1 line
2.24.1
#1 lore raw
Quoted 39 lines · Florian Westphal

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(a)strlen.de>

---
net/mptcp/subflow.c | 4 ----

1 file changed, 4 deletions(-)
net/mptcp/subflow.c +0 -4
index abd97d1a8645..ae9173040f17 100644
@@ -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);
 	}
Signature · 1 line
2.24.1

I agree that these barriers are not needed.

--
Mat Martineau
Intel

#2 lore raw

Hi Florian, Mat,

Quoted 9 lines · Mat Martineau
Quoted 7 lines · Florian Westphal

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.

[...]

Quoted 1 line

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

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium