All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: ben.kuo.tw@proton.me
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH] man/man7/epoll.7: Note that an edge-triggered listener needs an accept loop
Date: Sun, 1 Nov 2026 14:08:50 +0100	[thread overview]
Message-ID: <auc5xI6XmdOUN0QA@devuan> (raw)
In-Reply-To: <20261015-epoll-et-listener-v1-1-2cc0027b658c@proton.me>

[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]

Hi Ben,

> Date: 2026-10-15 21:48:33+0800
> From: Ben Kuo via B4 Relay <devnull+ben.kuo.tw.proton.me@kernel.org>
>
> From: Ben Kuo <ben.kuo.tw@proton.me>
> 
> The example registers the listening socket as level-triggered and
> calls accept(2) once per event, but doesn't say that this only works
> for a level-triggered listener.  If a reader adds EPOLLET to the
> listening socket in the example, connections are left in the accept
> queue and the server stalls.
> 
> Tested on Linux 6.12 (Debian 13, arm64) with an echo server whose
> listening socket is registered with EPOLLET, and a client that opens
> 2000 connections at once.  With one accept4(2) call per listener
> event, the client never finishes: ss(8) shows 1420 connections left
> in the accept queue (Recv-Q), while the server stays blocked in
> epoll_wait(2).  With accept4(2) called in a loop until EAGAIN, all
> connections are echoed.
> 
> Link: <https://github.com/benkuotw/epoll-lab>
> Signed-off-by: Ben Kuo <ben.kuo.tw@proton.me>
> ---

Thanks!  I've applied the patch.


Have a lovely day!
Alex

>  man/man7/epoll.7 | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/man/man7/epoll.7 b/man/man7/epoll.7
> index 2628cbb168b499786e495cf3c614fc5e58217295..aff844a568a5cd6d8eb310ed833266a0ccfd0a4d 100644
> --- a/man/man7/epoll.7
> +++ b/man/man7/epoll.7
> @@ -339,6 +339,16 @@ for (;;) {
>  .EE
>  .in
>  .P
> +The listening socket in this example is level-triggered.
> +If it is registered with
> +.BR EPOLLET ,
> +.BR accept (2)
> +must be called in a loop until it fails with
> +.BR EAGAIN :
> +a single event may report several pending connections,
> +and no further event is reported for those still queued
> +until another connection arrives.
> +.P
>  When used as an edge-triggered interface, for performance reasons, it is
>  possible to add the file descriptor inside the
>  .B epoll
> 
> ---
> base-commit: c6cefe27dd02beaf518bb654493e5f09e62b3225
> change-id: 20261015-epoll-et-listener-c9873cce62bc
> 
> Best regards,
> -- 
> Ben Kuo <ben.kuo.tw@proton.me>
> 
> 
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2026-11-01 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 13:48 [PATCH] man/man7/epoll.7: Note that an edge-triggered listener needs an accept loop Ben Kuo via B4 Relay
2026-10-15 13:48 ` Ben Kuo
2026-11-01  8:35 ` Ben Kuo
2026-11-01 13:08 ` Alejandro Colomar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auc5xI6XmdOUN0QA@devuan \
    --to=alx@kernel.org \
    --cc=ben.kuo.tw@proton.me \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.