* [PATCH net] mptcp: add missing memory scheduling in the rx path
@ 2020-10-27 14:59 Paolo Abeni
2020-10-27 22:46 ` Mat Martineau
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2020-10-27 14:59 UTC (permalink / raw)
To: netdev; +Cc: Jakub Kicinski, mptcp
When moving the skbs from the subflow into the msk receive
queue, we must schedule there the required amount of memory.
Try to borrow the required memory from the subflow, if needed,
so that we leverage the existing TCP heuristic.
Fixes: 6771bfd9ee24 ("mptcp: update mptcp ack sequence from work queue")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
net/mptcp/protocol.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 185dacb39781..e7419fd15d84 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -274,6 +274,15 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
skb_ext_reset(skb);
skb_orphan(skb);
+ /* try to fetch required memory from subflow */
+ if (!sk_rmem_schedule(sk, skb, skb->truesize)) {
+ if (ssk->sk_forward_alloc < skb->truesize)
+ goto drop;
+ __sk_mem_reclaim(ssk, skb->truesize);
+ if (!sk_rmem_schedule(sk, skb, skb->truesize))
+ goto drop;
+ }
+
/* the skb map_seq accounts for the skb offset:
* mptcp_subflow_get_mapped_dsn() is based on the current tp->copied_seq
* value
@@ -301,6 +310,7 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
* will retransmit as needed, if needed.
*/
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA);
+drop:
mptcp_drop(sk, skb);
return false;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] mptcp: add missing memory scheduling in the rx path
2020-10-27 14:59 [PATCH net] mptcp: add missing memory scheduling in the rx path Paolo Abeni
@ 2020-10-27 22:46 ` Mat Martineau
2020-10-29 18:29 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Mat Martineau @ 2020-10-27 22:46 UTC (permalink / raw)
To: Paolo Abeni; +Cc: netdev, Jakub Kicinski, mptcp
On Tue, 27 Oct 2020, Paolo Abeni wrote:
> When moving the skbs from the subflow into the msk receive
> queue, we must schedule there the required amount of memory.
>
> Try to borrow the required memory from the subflow, if needed,
> so that we leverage the existing TCP heuristic.
>
> Fixes: 6771bfd9ee24 ("mptcp: update mptcp ack sequence from work queue")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> net/mptcp/protocol.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
--
Mat Martineau
Intel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] mptcp: add missing memory scheduling in the rx path
2020-10-27 22:46 ` Mat Martineau
@ 2020-10-29 18:29 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-10-29 18:29 UTC (permalink / raw)
To: Mat Martineau; +Cc: Paolo Abeni, netdev, mptcp
On Tue, 27 Oct 2020 15:46:11 -0700 (PDT) Mat Martineau wrote:
> On Tue, 27 Oct 2020, Paolo Abeni wrote:
> > When moving the skbs from the subflow into the msk receive
> > queue, we must schedule there the required amount of memory.
> >
> > Try to borrow the required memory from the subflow, if needed,
> > so that we leverage the existing TCP heuristic.
> >
> > Fixes: 6771bfd9ee24 ("mptcp: update mptcp ack sequence from work queue")
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
>
> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-29 18:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27 14:59 [PATCH net] mptcp: add missing memory scheduling in the rx path Paolo Abeni
2020-10-27 22:46 ` Mat Martineau
2020-10-29 18:29 ` Jakub Kicinski
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).