Skip to content

Commit e226d92

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: fix spurious wake-up on under memory pressure
The wake-up condition currently implemented by mptcp_epollin_ready() is wrong, as it could mark the MPTCP socket as readable even when no data are present and the system is under memory pressure. Explicitly check for some data being available in the receive queue. Fixes: 5684ab1 ("mptcp: give rcvlowat some love") Cc: [email protected] Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/20250113-net-mptcp-connect-st-flakes-v1-2-0d986ee7b1b6@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2ca06a2 commit e226d92

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/mptcp/protocol.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,10 +760,15 @@ static inline u64 mptcp_data_avail(const struct mptcp_sock *msk)
760760

761761
static inline bool mptcp_epollin_ready(const struct sock *sk)
762762
{
763+
u64 data_avail = mptcp_data_avail(mptcp_sk(sk));
764+
765+
if (!data_avail)
766+
return false;
767+
763768
/* mptcp doesn't have to deal with small skbs in the receive queue,
764-
* at it can always coalesce them
769+
* as it can always coalesce them
765770
*/
766-
return (mptcp_data_avail(mptcp_sk(sk)) >= sk->sk_rcvlowat) ||
771+
return (data_avail >= sk->sk_rcvlowat) ||
767772
(mem_cgroup_sockets_enabled && sk->sk_memcg &&
768773
mem_cgroup_under_socket_pressure(sk->sk_memcg)) ||
769774
READ_ONCE(tcp_memory_pressure);

0 commit comments

Comments
 (0)