public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH 0/5] Refactor epoll handling in preparation for multithreading
Date: Fri,  3 Oct 2025 17:27:12 +0200	[thread overview]
Message-ID: <20251003152717.2437765-1-lvivier@redhat.com> (raw)

This series refactors how epoll file descriptors are managed throughout
the codebase in preparation for introducing multithreading support.
Currently, passt uses a single global epollfd accessed through the
context structure. With multithreading, each thread will have its own
epollfd managing its subset of flows.

The key changes are:

1. Simplify epoll_del() to take the epollfd directly rather than
   extracting it from the context structure, reducing tight coupling.

2. Move epoll registration out of the socket creation function
   (sock_l4_sa()) into protocol-specific code, giving callers explicit
   control over which epoll instance manages each socket.

3. Replace the boolean in_epoll flag in TCP connection structures with
   an epollfd field in flow_common. This serves dual purposes: tracking
   whether a flow is registered (zero = not registered) and which epoll
   instance owns it (non-zero = specific epollfd).

4. Apply this pattern consistently across all protocol handlers (TCP,
   ICMP, UDP), storing the managing epollfd in each flow's common
   structure.

These changes make the epoll ownership model explicit in the flow
tracking system, allowing flows to be managed by different epoll
instances - a prerequisite for the per-thread epollfd design in the
upcoming multithreading work.

Laurent Vivier (5):
  util: Simplify epoll_del() interface to take epollfd directly
  util: Move epoll registration out of sock_l4_sa()
  tcp, flow: Replace per-connection in_epoll flag with epollfd in
    flow_common
  icmp: Use epollfd from flow_common structure
  udp: Use epollfd from flow_common structure

 flow.c       | 12 +++++-------
 flow.h       |  4 +++-
 icmp.c       | 23 ++++++++++++++++++-----
 pif.c        | 34 ++++++++++++++++++++++++++++------
 tap.c        |  2 +-
 tcp.c        | 36 ++++++++++++++++++------------------
 tcp_conn.h   |  8 +-------
 tcp_splice.c | 23 +++++++++++------------
 udp_flow.c   | 23 ++++++++++++++++++++---
 util.c       | 21 ++++-----------------
 util.h       |  4 ++--
 vhost_user.c |  6 +++---
 12 files changed, 114 insertions(+), 82 deletions(-)

-- 
2.50.1



             reply	other threads:[~2025-10-03 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03 15:27 Laurent Vivier [this message]
2025-10-03 15:27 ` [PATCH 1/5] util: Simplify epoll_del() interface to take epollfd directly Laurent Vivier
2025-10-07  5:26   ` David Gibson
2025-10-03 15:27 ` [PATCH 2/5] util: Move epoll registration out of sock_l4_sa() Laurent Vivier
2025-10-07  5:57   ` David Gibson
2025-10-03 15:27 ` [PATCH 3/5] tcp, flow: Replace per-connection in_epoll flag with epollfd in flow_common Laurent Vivier
2025-10-07  6:07   ` David Gibson
2025-10-07  9:51     ` Stefano Brivio
2025-10-03 15:27 ` [PATCH 4/5] icmp: Use epollfd from flow_common structure Laurent Vivier
2025-10-03 15:27 ` [PATCH 5/5] udp: " Laurent Vivier

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=20251003152717.2437765-1-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).