From: Laurent Vivier <lvivier@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 3/5] tcp, flow: Replace per-connection in_epoll flag with epollfd in flow_common
Date: Thu, 9 Oct 2025 09:14:09 +0200 [thread overview]
Message-ID: <b30ce876-860e-4683-90b2-5ba9f247aa96@redhat.com> (raw)
In-Reply-To: <aOWvQwQiDrI94_ZR@zatzit>
On 08/10/2025 02:24, David Gibson wrote:
> On Tue, Oct 07, 2025 at 03:26:23PM +0200, Laurent Vivier wrote:
>> On 07/10/2025 08:07, David Gibson wrote:
>>> On Fri, Oct 03, 2025 at 05:27:15PM +0200, Laurent Vivier wrote:
>>>> The in_epoll boolean flag in tcp_tap_conn and tcp_splice_conn only tracked
>>>> whether a connection was registered with epoll, not which epoll instance.
>>>> This limited flexibility for future multi-epoll support.
>>>>
>>>> Replace the boolean with an epollfd field in flow_common that serves dual
>>>> purpose: zero indicates not registered (replacing in_epoll=false), non-zero
>>>
>>> Don't use 0, since that's a valid fd.
>>>
>>>> stores the actual epoll fd (replacing in_epoll=true).
>>>
>>> I am a bit nervous about adding 31-bits to every flow, since I think
>>> we're fairly close to a cacheline threshold.
>>>
>>> I'm not sure we really can add any less to flow_common, though, given
>>> alignment.
>>>
>>> Then again... we probably don't need 8 bites each for TYPE and STATE,
>>> so those could be packed tighter. Then we could use a limited-bits
>>> index into a table of epollfds, rather than a raw fd. Much uglier,
>>> but maybe worth it?
>>>
>>
>> I tried the epollfds table. But it introduces complexity and a new shared
>> data structure that we will need to manage correctly in the case of
>> multithreading. I don't think it's the way to follow...
>
> I was assuming it would be a write-once data structure, meaning
> multithreaded management shouldn't be too hard. But ok.
I'm going to try that anyway: for multiqueue I would need to store the queue id in
flow_common, and I have an array of queues with the epollfd, so I'll have the indirection
and the number of queues is limited so it would fit in 8-bit (or less).
I prepare a v3 with this change.
Thanks,
Laurent
next prev parent reply other threads:[~2025-10-09 7:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 15:27 [PATCH 0/5] Refactor epoll handling in preparation for multithreading Laurent Vivier
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-07 12:07 ` Laurent Vivier
2025-10-07 12:15 ` Stefano Brivio
2025-10-08 0:12 ` David Gibson
2025-10-07 13:26 ` Laurent Vivier
2025-10-08 0:24 ` David Gibson
2025-10-09 7:14 ` Laurent Vivier [this message]
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=b30ce876-860e-4683-90b2-5ba9f247aa96@redhat.com \
--to=lvivier@redhat.com \
--cc=david@gibson.dropbear.id.au \
--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).