[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190507120857.5975c059@carbon>
Date: Tue, 7 May 2019 12:08:57 +0200
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc: Tariq Toukan <tariqt@...lanox.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Eran Ben Elisha <eranbe@...lanox.com>, brouer@...hat.com,
Alexander Duyck <alexander.duyck@...il.com>
Subject: Re: [PATCH net-next 1/2] net: Take common prefetch code structure
into a function
On Mon, 6 May 2019 16:51:57 -0700
Jakub Kicinski <jakub.kicinski@...ronome.com> wrote:
> On Sun, 5 May 2019 13:36:06 +0300, Tariq Toukan wrote:
> > Many device drivers use the same prefetch code structure to
> > deal with small L1 cacheline size.
> > Take this code into a function and call it from the drivers.
> >
> > Suggested-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
> > Signed-off-by: Tariq Toukan <tariqt@...lanox.com>
> > Reviewed-by: Saeed Mahameed <saeedm@...lanox.com>
> > Cc: Jesper Dangaard Brouer <brouer@...hat.com>
>
> We could bike shed on the name a little - net_prefetch_headers() ?
> but at least a short kdoc explanation for the purpose of this helper
> would be good IMHO.
I would at least improve the commit message. As Alexander so nicely
explained[1], this prefetch purpose: "the 2 prefetches are needed for x86
if you want a full TCP or IPv6 header pulled into the L1 cache for
instance." Although, this is not true for a minimum TCP-packet
Eth(14)+IP(20)+TCP(20)=54 bytes. An I missing an alignment in my calc?
[1] https://lore.kernel.org/netdev/CAKgT0UeEL3W42eDqSt97xnn3tXDtWMf4sdPByAtvbx=Z7Sx7hQ@mail.gmail.com/
The name net_prefetch_headers() suggested by Jakub makes sense, as this
indicate that this should be used for prefetching packet headers.
As Alexander also explained, I was wrong in thinking the HW DCU (Data
Cache Unit) prefetcher will fetch two cache-lines automatically. As
the DCU prefetcher is a streaming prefetcher, and doesn't see our
access pattern, which is why we need this.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists