MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH net-next v3 1/3] mptcp: never fetch fwd memory from the subflow
@ 2022-06-20 16:19 Paolo Abeni
  2022-06-20 16:19 ` [PATCH net-next v3 2/3] mptcp: drop SK_RECLAIM_* macros Paolo Abeni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paolo Abeni @ 2022-06-20 16:19 UTC (permalink / raw)
  To: mptcp

The memory accounting is broken in such exceptional code
path, and after commit 4890b686f408 ("net: keep sk->sk_forward_alloc
as small as possible") we can't find much help there.

Drop the broken code.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
This is possibly for net, but makes sense only on top of recent
net-next patches, so whatever ;)
---
 net/mptcp/protocol.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 6d2aa41390e7..0d4b2c010da0 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -328,15 +328,10 @@ static bool mptcp_rmem_schedule(struct sock *sk, struct sock *ssk, int size)
 
 	amt = sk_mem_pages(size);
 	amount = amt << PAGE_SHIFT;
-	msk->rmem_fwd_alloc += amount;
-	if (!__sk_mem_raise_allocated(sk, size, amt, SK_MEM_RECV)) {
-		if (ssk->sk_forward_alloc < amount) {
-			msk->rmem_fwd_alloc -= amount;
-			return false;
-		}
+	if (!__sk_mem_raise_allocated(sk, size, amt, SK_MEM_RECV))
+		return false;
 
-		ssk->sk_forward_alloc -= amount;
-	}
+	msk->rmem_fwd_alloc += amount;
 	return true;
 }
 
-- 
2.35.3


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

end of thread, other threads:[~2022-06-20 20:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20 16:19 [PATCH net-next v3 1/3] mptcp: never fetch fwd memory from the subflow Paolo Abeni
2022-06-20 16:19 ` [PATCH net-next v3 2/3] mptcp: drop SK_RECLAIM_* macros Paolo Abeni
2022-06-20 20:38   ` Mat Martineau
2022-06-20 16:19 ` [PATCH net-next v3 3/3] mptcp: refine memory scheduling Paolo Abeni
2022-06-20 20:32   ` Mat Martineau
2022-06-20 16:46 ` [PATCH net-next v3 1/3] mptcp: never fetch fwd memory from the subflow Paolo Abeni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox