From: Jiayuan Chen <mrpre@163.com>
To: Eric Dumazet <edumazet@google.com>,
Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: netdev@vger.kernel.org, Neal Cardwell <ncardwell@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
"David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v1] tcp: remove redundant memset in hot paths with CONFIG_INIT_STACK_ALL_ZERO
Date: Thu, 12 Mar 2026 21:45:56 +0800 [thread overview]
Message-ID: <e00bace9-3826-4308-b083-9bd10682425d@163.com> (raw)
In-Reply-To: <CANn89i+urEcFJkOsE9_3nOzVa2Ee1sFb26vrNnJV-jW2z76y2w@mail.gmail.com>
On 3/12/26 8:53 PM, Eric Dumazet wrote:
> On Thu, Mar 12, 2026 at 1:48 PM Jiayuan Chen <jiayuan.chen@linux.dev> wrote:
>> Modern compilers with CONFIG_INIT_STACK_ALL_ZERO enabled
>> (-ftrivial-auto-var-init=zero) automatically zero-initialize all stack
>> variables via `rep stos` in the function prologue. However, the compiler
>> cannot eliminate explicit memset() calls on those same variables,
>> resulting in redundant zeroing of the same memory region.
>>
>> Replace explicit memset() with `= {0}` initializers for stack variables
>> in TCP hot path functions. With `= {0}`, the compiler recognizes a single
>> initialization and generates only one zeroing sequence, whereas a
>> separate memset() after declaration always produces a second `rep stos`.
> No sorry. It seems you missed
>
> commit cfcceb7a39fc10a6f896af8229bf81d96acb22cc
> Author: Keita Morisaki <kmta1236@gmail.com>
> Date: Wed Mar 4 20:15:17 2026 +0900
>
> tcp: shrink per-packet memset in __tcp_transmit_skb()
>
> No need to resend your patch, I do not think it is a good idea.
Thanks. It seems this patch for __tcp_transmit_skb only saves a few bytes
of memset.
prev parent reply other threads:[~2026-03-12 13:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 12:48 Jiayuan Chen
2026-03-12 12:53 ` Eric Dumazet
2026-03-12 13:45 ` Jiayuan Chen [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=e00bace9-3826-4308-b083-9bd10682425d@163.com \
--to=mrpre@163.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiayuan.chen@linux.dev \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®