[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aNqHt7dgy3tWRGjZ@horms.kernel.org>
Date: Mon, 29 Sep 2025 14:20:55 +0100
From: Simon Horman <horms@...nel.org>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Jason Wang <jasowang@...hat.com>
Subject: Re: [PATCH net-next] ptr_ring: __ptr_ring_zero_tail micro
optimization
On Sat, Sep 27, 2025 at 08:29:35AM -0400, Michael S. Tsirkin wrote:
> __ptr_ring_zero_tail currently does the - 1 operation twice:
> - during initialization of head
> - at each loop iteration
>
> Let's just do it in one place, all we need to do
> is adjust the loop condition. this is better:
> - a slightly clearer logic with less duplication
> - uses prefix -- we don't need to save the old value
> - one less - 1 operation - for example, when ring is empty
> we now don't do - 1 at all, existing code does it once
>
> Text size shrinks from 15081 to 15050 bytes.
>
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists