Message ID | 1512418610-84032-3-git-send-email-bhanuprakash.bodireddy@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev,RFC,1/5] compiler: Introduce OVS_PREFETCH variants. | expand |
On Mon, Dec 04, 2017 at 08:16:48PM +0000, Bhanuprakash Bodireddy wrote: > With ovs_prefetch_range(), large amounts of data can be prefetched in to > caches. Prefetch type gives better control over data caching strategy; > Meaning where the data should be prefetched(L1/L2/L3) and if the data > reference is temporal or non-temporal. > > Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> I'll leave review of patches 3-5 to others who better understand the specific issues.
>On Mon, Dec 04, 2017 at 08:16:48PM +0000, Bhanuprakash Bodireddy wrote: >> With ovs_prefetch_range(), large amounts of data can be prefetched in >> to caches. Prefetch type gives better control over data caching >> strategy; Meaning where the data should be prefetched(L1/L2/L3) and if >> the data reference is temporal or non-temporal. >> >> Signed-off-by: Bhanuprakash Bodireddy >> <bhanuprakash.bodireddy@intel.com> > >I'll leave review of patches 3-5 to others who better understand the specific >issues. No problem, I posted this as RFC to get early feedback and am currently looking at bottlenecks in other usecases (vxlans, conntrack) with multiple pmd threads to use prefetching. - Bhanuprakash.
diff --git a/lib/pvector.h b/lib/pvector.h index b175b21..d5655f0 100644 --- a/lib/pvector.h +++ b/lib/pvector.h @@ -177,7 +177,8 @@ pvector_cursor_init(const struct pvector *pvec, impl = ovsrcu_get(struct pvector_impl *, &pvec->impl); - ovs_prefetch_range(impl->vector, impl->size * sizeof impl->vector[0]); + ovs_prefetch_range(impl->vector, impl->size * sizeof impl->vector[0], + OPCH_HTR); cursor.size = impl->size; cursor.vector = impl->vector; @@ -208,7 +209,8 @@ static inline void pvector_cursor_lookahead(const struct pvector_cursor *cursor, int n, size_t size) { if (cursor->entry_idx + n < cursor->size) { - ovs_prefetch_range(cursor->vector[cursor->entry_idx + n].ptr, size); + ovs_prefetch_range(cursor->vector[cursor->entry_idx + n].ptr, size, + OPCH_HTR); } } diff --git a/lib/util.h b/lib/util.h index b01f421..f01ac7a 100644 --- a/lib/util.h +++ b/lib/util.h @@ -71,13 +71,13 @@ BUILD_ASSERT_DECL(IS_POW2(CACHE_LINE_SIZE)); typedef uint8_t OVS_CACHE_LINE_MARKER[1]; static inline void -ovs_prefetch_range(const void *start, size_t size) +ovs_prefetch_range(const void *start, size_t size, enum ovs_prefetch_type type) { const char *addr = (const char *)start; size_t ofs; for (ofs = 0; ofs < size; ofs += CACHE_LINE_SIZE) { - OVS_PREFETCH(addr + ofs); + OVS_PREFETCH_CACHE(addr + ofs, type); } }
With ovs_prefetch_range(), large amounts of data can be prefetched in to caches. Prefetch type gives better control over data caching strategy; Meaning where the data should be prefetched(L1/L2/L3) and if the data reference is temporal or non-temporal. Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> --- lib/pvector.h | 6 ++++-- lib/util.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)