[v7,1/4] net/i40e: use inline prefetch function
Checks
Commit Message
Don't directly access the cacheline1 field in rte_mbuf struct for
prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 20 March 2024 23.02
>
> Don't directly access the cacheline1 field in rte_mbuf struct for
> prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
> drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> index f3050cd..0238b03 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> @@ -826,7 +826,7 @@
> free[0] = m;
> nb_free = 1;
> for (i = 1; i < n; i++) {
> - rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> + rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
@Yuying Zhang:
If this prefetch is for m->next, I think it can be omitted if m->next is in the first cache line:
- rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+#if RTE_IOVA_IN_MBUF
+ rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
+#endif
If so, it belongs in a separate patch anyway.
> m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
> if (likely(m)) {
> if (likely(m->pool == free[0]->pool)) {
> --
> 1.8.3.1
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
On Tue, Mar 26, 2024 at 11:16:10AM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 20 March 2024 23.02
> >
> > Don't directly access the cacheline1 field in rte_mbuf struct for
> > prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> > drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > index f3050cd..0238b03 100644
> > --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > @@ -826,7 +826,7 @@
> > free[0] = m;
> > nb_free = 1;
> > for (i = 1; i < n; i++) {
> > - rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> > + rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
>
> @Yuying Zhang:
> If this prefetch is for m->next, I think it can be omitted if m->next is in the first cache line:
>
> - rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> +#if RTE_IOVA_IN_MBUF
> + rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
> +#endif
Yuying Zhang any reply here to confirm?
If not I will leave it unconditionally prefetch.
>
> If so, it belongs in a separate patch anyway.
>
> > m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
> > if (likely(m)) {
> > if (likely(m->pool == free[0]->pool)) {
> > --
> > 1.8.3.1
>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 27 March 2024 19.15
>
> On Tue, Mar 26, 2024 at 11:16:10AM +0100, Morten Brørup wrote:
> > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > Sent: Wednesday, 20 March 2024 23.02
> > >
> > > Don't directly access the cacheline1 field in rte_mbuf struct for
> > > prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > > drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > index f3050cd..0238b03 100644
> > > --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > @@ -826,7 +826,7 @@
> > > free[0] = m;
> > > nb_free = 1;
> > > for (i = 1; i < n; i++) {
> > > - rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> > > + rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
> >
> > @Yuying Zhang:
> > If this prefetch is for m->next, I think it can be omitted if m->next
> is in the first cache line:
> >
> > - rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> > +#if RTE_IOVA_IN_MBUF
> > + rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
> > +#endif
>
> Yuying Zhang any reply here to confirm?
>
> If not I will leave it unconditionally prefetch.
I think you should leave it unconditionally prefetch under all circumstances.
An optimization to omit it (if it can be conditionally omitted) belongs in a separate patch. Also, Intel might want to test and document the performance improvement of such a patch.
>
> >
> > If so, it belongs in a separate patch anyway.
> >
> > > m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
> > > if (likely(m)) {
> > > if (likely(m->pool == free[0]->pool)) {
> > > --
> > > 1.8.3.1
> >
> > Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
@@ -826,7 +826,7 @@
free[0] = m;
nb_free = 1;
for (i = 1; i < n; i++) {
- rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+ rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
if (likely(m)) {
if (likely(m->pool == free[0]->pool)) {