Message ID | 1512418610-84032-4-git-send-email-bhanuprakash.bodireddy@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev,RFC,1/5] compiler: Introduce OVS_PREFETCH variants. | expand |
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);
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@intel.com> --- lib/packets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)