Avoid the cache miss consequences of spraying [functionally harmless]
junk into un-prefetched rewrite space. As things stand, several tunnel
encap rewrites set rewrite data_bytes = 0, and take a performance hit
due to unwanted speculative copying.
Should be performance-neutral in speed-path cases, which won't execute
the added check.
Change-Id: Id83c0325e58c0f31631b4bae5a06457dfc7ed567
Signed-off-by: Dave Barach <dave@barachs.net>
clib_memcpy (d, s, sizeof (eh_copy_t));
return;
}
-
+ /*
+ * Stop now if the data_bytes field is zero, to avoid the cache
+ * miss consequences of spraying [functionally harmless] junk into
+ * un-prefetched rewrite space.
+ */
+ if (PREDICT_FALSE (h0->data_bytes == 0))
+ return;
#define _(i) \
do { \
return;
}
+ /*
+ * Stop now if both rewrite data_bytes fields are zero, to avoid the cache
+ * miss consequences of spraying [functionally harmless] junk into
+ * un-prefetched rewrite space.
+ */
+ if (PREDICT_FALSE (h0->data_bytes + h1->data_bytes == 0))
+ return;
+
#define _(i) \
do { \
if (most_likely_size > ((i)-1)*sizeof (vnet_rewrite_data_t)) \