netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org,  bpf@vger.kernel.org,
	 john.fastabend@gmail.com, zhoufeng.zf@bytedance.com,
	 zijianzhang@bytedance.com,  Cong Wang <cong.wang@bytedance.com>
Subject: Re: [Patch bpf-next 3/4] skmsg: use bitfields for struct sk_psock
Date: Thu, 27 Feb 2025 10:53:53 +0100	[thread overview]
Message-ID: <87eczju30u.fsf@cloudflare.com> (raw)
In-Reply-To: <Z7+UAA83/n9XgIdU@pop-os.localdomain> (Cong Wang's message of "Wed, 26 Feb 2025 14:21:52 -0800")

On Wed, Feb 26, 2025 at 02:21 PM -08, Cong Wang wrote:
> On Wed, Feb 26, 2025 at 02:49:17PM +0100, Jakub Sitnicki wrote:
>> On Sat, Feb 22, 2025 at 10:30 AM -08, Cong Wang wrote:
>> > From: Cong Wang <cong.wang@bytedance.com>
>> >
>> > psock->eval can only have 4 possible values, make it 8-bit is
>> > sufficient.
>> >
>> > psock->redir_ingress is just a boolean, using 1 bit is enough.
>> >
>> > Signed-off-by: Cong Wang <cong.wang@bytedance.com>
>> > ---
>> >  include/linux/skmsg.h | 4 ++--
>> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
>> > index bf28ce9b5fdb..beaf79b2b68b 100644
>> > --- a/include/linux/skmsg.h
>> > +++ b/include/linux/skmsg.h
>> > @@ -85,8 +85,8 @@ struct sk_psock {
>> >  	struct sock			*sk_redir;
>> >  	u32				apply_bytes;
>> >  	u32				cork_bytes;
>> > -	u32				eval;
>> > -	bool				redir_ingress; /* undefined if sk_redir is null */
>> > +	unsigned int			eval : 8;
>> > +	unsigned int			redir_ingress : 1; /* undefined if sk_redir is null */
>> >  	struct sk_msg			*cork;
>> >  	struct sk_psock_progs		progs;
>> >  #if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)
>> 
>> Are you doing this bit packing to create a hole big enough to fit
>> another u32 introduced in the next patch?
>
> Kinda, or at least trying to save some space for the next patch. I am
> not yet trying to reorder them to make it more packed, because it can
> be a separate patch.

OK. Asking because the intention is not expressed in the description.

Nit: Why the switch to an implicitly sized integer type?
It feels a bit silly when you can just declare an `u8 eval`.


  reply	other threads:[~2025-02-27  9:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-22 18:30 [Patch bpf-next 0/4] tcp_bpf: improve ingress redirection performance with message corking Cong Wang
2025-02-22 18:30 ` [Patch bpf-next 1/4] skmsg: rename sk_msg_alloc() to sk_msg_expand() Cong Wang
2025-02-22 18:30 ` [Patch bpf-next 2/4] skmsg: implement slab allocator cache for sk_msg Cong Wang
2025-02-22 18:30 ` [Patch bpf-next 3/4] skmsg: use bitfields for struct sk_psock Cong Wang
2025-02-26 13:49   ` Jakub Sitnicki
2025-02-26 22:21     ` Cong Wang
2025-02-27  9:53       ` Jakub Sitnicki [this message]
2025-02-27 19:14         ` Cong Wang
2025-02-22 18:30 ` [Patch bpf-next 4/4] tcp_bpf: improve ingress redirection performance with message corking Cong Wang

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=87eczju30u.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=bpf@vger.kernel.org \
    --cc=cong.wang@bytedance.com \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    --cc=zhoufeng.zf@bytedance.com \
    --cc=zijianzhang@bytedance.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.
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 NNTP newsgroup(s).