[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <411eb4ba-3226-44f2-aabe-5d68df01f867@redhat.com>
Date: Wed, 27 Nov 2024 08:46:22 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Eric Dumazet <edumazet@...gle.com>,
Fernando Fernandez Mancera <ffmancera@...eup.net>
Cc: netdev@...r.kernel.org, willemb@...gle.com
Subject: Re: [PATCH net] udp: call sock_def_readable() if socket is not
SOCK_FASYNC
Hi,
I'm sorry for the latency here.
On 11/26/24 19:41, Eric Dumazet wrote:
> On Tue, Nov 26, 2024 at 7:32 PM Eric Dumazet <edumazet@...gle.com> wrote:
>>
>> On Tue, Nov 26, 2024 at 6:56 PM Fernando Fernandez Mancera
>> <ffmancera@...eup.net> wrote:
>>>
>>> If a socket is not SOCK_FASYNC, sock_def_readable() needs to be called
>>> even if receive queue was not empty. Otherwise, if several threads are
>>> listening on the same socket with blocking recvfrom() calls they might
>>> hang waiting for data to be received.
>>>
>>
>> SOCK_FASYNC seems completely orthogonal to the issue.
>>
>> First sock_def_readable() should wakeup all threads, I wonder what is happening.
>
> Oh well, __skb_wait_for_more_packets() is using
> prepare_to_wait_exclusive(), so in this case sock_def_readable() is
> waking only one thread.
Very likely whatever I'll add here will be of little use, still...
AFAICS prepare_to_wait_exclusive() is there since pre git times, so its
usage not be the cause of behaviors changes.
>> UDP can store incoming packets into sk->sk_receive_queue and
>> udp_sk(sk)->reader_queue
>>
>> Paolo, should __skb_wait_for_more_packets() for UDP socket look at both queues ?
That in case multiple threads are woken-up and thread-1 splices
sk_receive_queue into reader_queue before thread-2 has any chance of
checking the first, I guess?
With prepare_to_wait_exclusive, checking a single queue should be ok.
/P
Powered by blists - more mailing lists