[ovs-dev] [PATCH RFC 4/5] util: Use OPCH_NTR type while prefetching packet metadata.
Bhanuprakash Bodireddy
bhanuprakash.bodireddy at intel.com
Mon Dec 4 20:16:49 UTC 2017
OVS_PREFETCH by default uses OPCH_HTR(High Temporal Read), meaning
the prefetch is in preparation for a future read and the prefetched
data is made available in all levels of caches.
However the pkt_metadata_prefetch_init() prefetches the metadata so that
the data is readily available when pkt_metadata_init() zeroes out the
same. So a 'write' operation is actually performed instead of anticipated
'read' on the prefetched data.
Doing a 'write' isn't a problem as the metadata isn't shared between the
threads and doesn't need invalidation across other cores and so read
prefetch is enough with non-temporal reference so not to pollute the
cache. This change seems to positively affect performance.
Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
---
lib/packets.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/packets.h b/lib/packets.h
index 13ea46d..e422fc0 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -165,10 +165,10 @@ pkt_metadata_prefetch_init(struct pkt_metadata *md)
{
/* Prefetch cacheline0 as members till ct_state and odp_port will
* be initialized later in pkt_metadata_init(). */
- OVS_PREFETCH(md->cacheline0);
+ OVS_PREFETCH_CACHE(md->cacheline0, OPCH_NTR);
/* Prefetch cachline2 as ip_dst & ipv6_dst fields will be initialized. */
- OVS_PREFETCH(md->cacheline2);
+ OVS_PREFETCH_CACHE(md->cacheline2, OPCH_NTR);
}
bool dpid_from_string(const char *s, uint64_t *dpidp);
--
2.4.11
More information about the dev
mailing list