mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: mptcp@lists.linux.dev
Subject: [PATCH v4 mptcp-next 3/4] mptcp: refine memory scheduling
Date: Tue, 21 Jun 2022 18:27:36 +0200	[thread overview]
Message-ID: <fe5cb4f8ae9c9218147af1cd37f60c3ef28ec5df.1655828070.git.pabeni@redhat.com> (raw)
In-Reply-To: <630f7e13d7226f8c37a9cc0c66008a298c1e6b9e.1655828070.git.pabeni@redhat.com>

Similar to commit 7c80b038d23e ("net: fix sk_wmem_schedule() and
sk_rmem_schedule() errors"), let the MPTCP receive path schedule
exactly the required amount of memory.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
v3 -> v4:
 - do not allocate 0 bytes (Mat)
---
 net/mptcp/protocol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index b31bac33f87a..b1fae2f747c9 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -323,9 +323,10 @@ static bool mptcp_rmem_schedule(struct sock *sk, struct sock *ssk, int size)
 	struct mptcp_sock *msk = mptcp_sk(sk);
 	int amt, amount;
 
-	if (size < msk->rmem_fwd_alloc)
+	if (size <= msk->rmem_fwd_alloc)
 		return true;
 
+	size -= msk->rmem_fwd_alloc;
 	amt = sk_mem_pages(size);
 	amount = amt << PAGE_SHIFT;
 	if (!__sk_mem_raise_allocated(sk, size, amt, SK_MEM_RECV))
-- 
2.35.3


  parent reply	other threads:[~2022-06-21 16:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 16:27 [PATCH v4 mptcp-next 1/4] mptcp: never fetch fwd memory from the subflow Paolo Abeni
2022-06-21 16:27 ` [PATCH v4 mptcp-next 2/4] mptcp: drop SK_RECLAIM_* macros Paolo Abeni
2022-06-21 16:27 ` Paolo Abeni [this message]
2022-06-21 16:27 ` [PATCH v4 mptcp-next 4/4] net: remove SK_RECLAIM_THRESHOLD and SK_RECLAIM_CHUNK Paolo Abeni
2022-06-21 22:38   ` Mat Martineau
2022-06-22 21:09     ` Matthieu Baerts
2022-06-21 22:35 ` [PATCH v4 mptcp-next 1/4] mptcp: never fetch fwd memory from the subflow Mat Martineau
2022-06-21 22:46   ` Mat Martineau
2022-06-22  8:31     ` Paolo Abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe5cb4f8ae9c9218147af1cd37f60c3ef28ec5df.1655828070.git.pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).