[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7dcca571-856b-36f9-cf56-4a3c63c07e4e@engleder-embedded.com>
Date: Thu, 20 Apr 2023 20:51:06 +0200
From: Gerhard Engleder <gerhard@...leder-embedded.com>
To: Stephen Hemminger <stephen@...workplumber.org>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, davem@...emloft.net,
kuba@...nel.org, edumazet@...gle.com, pabeni@...hat.com,
bjorn@...nel.org, magnus.karlsson@...el.com,
jonathan.lemon@...il.com
Subject: Re: [PATCH net-next v3 1/6] tsnep: Replace modulo operation with mask
On 20.04.23 17:10, Stephen Hemminger wrote:
> On Thu, 20 Apr 2023 16:23:10 +0200
> Maciej Fijalkowski <maciej.fijalkowski@...el.com> wrote:
>
>> On Tue, Apr 18, 2023 at 09:04:54PM +0200, Gerhard Engleder wrote:
>>> TX/RX ring size is static and power of 2 to enable compiler to optimize
>>> modulo operation to mask operation. Make this optimization already in
>>> the code and don't rely on the compiler.
>>
>> I think this came out of my review, so:
>> Suggested-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
>>
>> Does this give you a minor perf boost?
>
> If you change the loop counter to be unsigned, then Gcc (and Clang)
> will optimize this into a mask operation. That is a better simpler fix.
>
> If loop counter (i) is an integer, then compiler has keep the
> potential for wrap around.
I'm unsure which solution should be preferred. But I could change to
unsigned anyway.
Powered by blists - more mailing lists