From: Simon Horman <horms@kernel.org>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"John Fastabend" <john.fastabend@gmail.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Jose E. Marchesi" <jose.marchesi@oracle.com>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Magnus Karlsson" <magnus.karlsson@intel.com>,
"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
"Jason Baron" <jbaron@akamai.com>,
"Casey Schaufler" <casey@schaufler-ca.com>,
"Nathan Chancellor" <nathan@kernel.org>,
bpf@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/4] unroll: add generic loop unroll helpers
Date: Mon, 10 Feb 2025 21:08:19 +0000 [thread overview]
Message-ID: <20250210210819.GF554665@kernel.org> (raw)
In-Reply-To: <fa01e28e-b75d-4d60-b10a-ccf3e544ff1e@intel.com>
On Mon, Feb 10, 2025 at 04:49:14PM +0100, Alexander Lobakin wrote:
> From: Simon Horman <horms@kernel.org>
> Date: Sun, 9 Feb 2025 11:07:25 +0000
>
> > On Thu, Feb 06, 2025 at 07:26:26PM +0100, Alexander Lobakin wrote:
> >> There are cases when we need to explicitly unroll loops. For example,
> >> cache operations, filling DMA descriptors on very high speeds etc.
> >> Add compiler-specific attribute macros to give the compiler a hint
> >> that we'd like to unroll a loop.
> >> Example usage:
> >>
> >> #define UNROLL_BATCH 8
> >>
> >> unrolled_count(UNROLL_BATCH)
> >> for (u32 i = 0; i < UNROLL_BATCH; i++)
> >> op(priv, i);
> >>
> >> Note that sometimes the compilers won't unroll loops if they think this
> >> would have worse optimization and perf than without unrolling, and that
> >> unroll attributes are available only starting GCC 8. For older compiler
> >> versions, no hints/attributes will be applied.
> >> For better unrolling/parallelization, don't have any variables that
> >> interfere between iterations except for the iterator itself.
> >>
> >> Co-developed-by: Jose E. Marchesi <jose.marchesi@oracle.com> # pragmas
> >> Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
> >> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> >> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> >
> > Hi Alexander,
> >
> > This patch adds four variants of the unrolled helper. But as far as I can
> > tell the patch-set only makes use of one of them, unrolled_count().
> >
> > I think it would be best if this patch only added helpers that are used.
>
> I thought they might help people in future.
> I can remove them if you insist. BTW the original patch from Jose also
> added several variants.
I do slightly prefer only adding what is used.
next prev parent reply other threads:[~2025-02-10 21:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 18:26 [PATCH net-next 0/4] xsk: the lost bits from Chapter III Alexander Lobakin
2025-02-06 18:26 ` [PATCH net-next 1/4] unroll: add generic loop unroll helpers Alexander Lobakin
2025-02-09 11:07 ` Simon Horman
2025-02-10 12:28 ` Maciej Fijalkowski
2025-02-10 15:49 ` Alexander Lobakin
2025-02-10 21:08 ` Simon Horman [this message]
2025-02-11 1:56 ` Jakub Kicinski
2025-02-06 18:26 ` [PATCH net-next 2/4] i40e: use generic unrolled_count() macro Alexander Lobakin
2025-02-10 12:30 ` Maciej Fijalkowski
2025-02-10 22:28 ` David Laight
2025-02-06 18:26 ` [PATCH net-next 3/4] ice: " Alexander Lobakin
2025-02-10 12:31 ` Maciej Fijalkowski
2025-02-06 18:26 ` [PATCH net-next 4/4] xsk: add helper to get &xdp_desc's DMA and meta pointer in one go Alexander Lobakin
2025-02-09 11:03 ` Simon Horman
2025-02-10 16:00 ` Alexander Lobakin
2025-02-10 21:06 ` Simon Horman
2025-02-11 2:00 ` [PATCH net-next 0/4] xsk: the lost bits from Chapter III patchwork-bot+netdevbpf
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=20250210210819.GF554665@kernel.org \
--to=horms@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=casey@schaufler-ca.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jbaron@akamai.com \
--cc=john.fastabend@gmail.com \
--cc=jose.marchesi@oracle.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=toke@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.