From: Jens Axboe <axboe@kernel.dk>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, kuniyu@google.com,
Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next] net: do not write to msg_get_inq in caller
Date: Mon, 5 Jan 2026 10:34:26 -0700 [thread overview]
Message-ID: <c85d912d-8123-41dd-859d-255b4940b4cf@kernel.dk> (raw)
In-Reply-To: <20260105163338.3461512-1-willemdebruijn.kernel@gmail.com>
On 1/5/26 9:32 AM, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> msg_get_inq is an input field from caller to callee. Don't set it in
> the callee, as the caller may not clear it on struct reuse.
>
> This is a kernel-internal variant of msghdr only, and the only user
> does reinitialize the field. So this is not critical.
>
> But it is more robust to avoid the write, and slightly simpler code.
>
> Callers set msg_get_inq to request the input queue length to be
> returned in msg_inq. This is equivalent to but independent from the
> SO_INQ request to return that same info as a cmsg (tp->recvmsg_inq).
> To reduce branching in the hot path the second also sets the msg_inq.
> That is WAI.
>
> This is a small follow-on to commit 4d1442979e4a ("af_unix: don't
> post cmsg for SO_INQ unless explicitly asked for"), which fixed the
> inverse.
>
> Also collapse two branches using a bitwise or.
Reviewed-by: Jens Axboe <axboe@kernel.dk>
I also ran my usual testing, and as expected, looks fine as well.
--
Jens Axboe
prev parent reply other threads:[~2026-01-05 17:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 16:32 [PATCH net-next] net: do not write to msg_get_inq in caller Willem de Bruijn
2026-01-05 17:21 ` Eric Dumazet
2026-01-05 17:42 ` Jens Axboe
2026-01-05 17:42 ` Willem de Bruijn
2026-01-05 17:44 ` Jens Axboe
2026-01-05 17:57 ` Willem de Bruijn
2026-01-05 17:58 ` Eric Dumazet
2026-01-05 17:58 ` Jens Axboe
2026-01-05 17:34 ` Jens Axboe [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=c85d912d-8123-41dd-859d-255b4940b4cf@kernel.dk \
--to=axboe@kernel.dk \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.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