diff options
| author | Paolo Abeni <[email protected]> | 2022-06-30 22:17:56 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2022-07-01 12:24:59 +0000 |
| commit | 69d93daec026cdda98e29e8edb12534bfa5b1a9b (patch) | |
| tree | dad36e35e0e9d2e24fff0311621b0ffbed617539 /net/mptcp/protocol.c | |
| parent | mptcp: drop SK_RECLAIM_* macros (diff) | |
| download | kernel-69d93daec026cdda98e29e8edb12534bfa5b1a9b.tar.gz kernel-69d93daec026cdda98e29e8edb12534bfa5b1a9b.zip | |
mptcp: refine memory scheduling
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 <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/mptcp/protocol.c')
| -rw-r--r-- | net/mptcp/protocol.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index b4b4ca897e14..d77ca57f5e6e 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)) |
