From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>, passt-dev@passt.top
Subject: Re: [PATCH 3/5] tcp, flow: Replace per-connection in_epoll flag with epollfd in flow_common
Date: Wed, 8 Oct 2025 11:12:03 +1100 [thread overview]
Message-ID: <aOWsU1PruwDHzNZl@zatzit> (raw)
In-Reply-To: <20251007141503.1a79ae57@elisabeth>
[-- Attachment #1: Type: text/plain, Size: 2470 bytes --]
On Tue, Oct 07, 2025 at 02:15:03PM +0200, Stefano Brivio wrote:
> On Tue, 7 Oct 2025 14:07:39 +0200
> Laurent Vivier <lvivier@redhat.com> wrote:
>
> > On 07/10/2025 11:51, Stefano Brivio wrote:
> > > On Tue, 7 Oct 2025 17:07:37 +1100
> > > David Gibson <david@gibson.dropbear.id.au> 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 mentioned to Laurent in our weekly call on Monday the same concern
> > > and that I would look into it (first step, I would say, actually check
> > > with pahole?) and, if it's an issue, into possible tricks to avoid
> > > making the struct too big. I still plan to do this.
> >
> > I think it already doesn't fit in a cacheline:
> >
> > struct flow_common {
> > enum flow_state state:8; /* 0: 0 4 */
> > enum flow_type type:8; /* 0: 8 4 */
> >
> > /* Bitfield combined with next fields */
> >
> > uint8_t pif[2]; /* 2 2 */
> > struct flowside side[2]; /* 4 72 */
> >
> > /* size: 76, cachelines: 2, members: 4 */
> > /* last cacheline: 12 bytes */
> > };
>
> Look at union flow, as we have an array of those, not flow_common. It's
> two cachelines at the moment, we shouldn't go beyond that, and keeping
> some margin would be nice as TCP might need some more bits
> eventually.
Right, I was unclear: it's going from 2 cachelines to 3 that I was
concerned about.
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-10-08 0:39 UTC|newest]
Thread overview: 15+ 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 [this message]
2025-10-07 13:26 ` Laurent Vivier
2025-10-08 0:24 ` David Gibson
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=aOWsU1PruwDHzNZl@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/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).