[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85bce8fc-6034-43fb-9f4e-45d955568aaa@riseup.net>
Date: Tue, 26 Nov 2024 20:17:48 +0100
From: "Fernando F. Mancera" <ffmancera@...eup.net>
To: Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, willemb@...gle.com
Subject: Re: [PATCH net] udp: call sock_def_readable() if socket is not
SOCK_FASYNC
Hi,
On 26/11/2024 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.
>
Well, it might be. But I noticed that if SOCK_FASYNC is set then
sk_wake_async_rcu() do its work and everything is fine. This is why I
thought checking on the flag was a good idea.
> 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.
>
Yes, this is what I was expecting. What would be the solution? Should I
change it to "prepare_to_wait()" instead? Although, I don't know the
implication that change might have.
Thank you for the comments, first time working on UDP socket
implementation so they are very helpful :)
>>
>> 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 ?
Powered by blists - more mailing lists