]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mptcp: refine memory scheduling
authorPaolo Abeni <pabeni@redhat.com>
Thu, 30 Jun 2022 22:17:56 +0000 (15:17 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Jul 2022 12:24:59 +0000 (13:24 +0100)
Similar to commit 91efb764f795 ("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>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c

index b4b4ca897e149f867ef4334eed542f42701b0dc5..d77ca57f5e6ed3f4783037f2ac2c1e32d4bc86bf 100644 (file)
@@ -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))