aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_buffer_inlines.h
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2016-07-22 13:04:54 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-07-26 15:24:01 +0300
commitec0d570b8f762ea79960d54cf8c4f36efdea2528 (patch)
tree71a73d20cf25ab636b899e85b76b9e7b83ebb638 /platform/linux-generic/include/odp_buffer_inlines.h
parent20f14c1e726c97cb675c26627c073b730bcb58e6 (diff)
linux-gen: pool: optimize thread local buffer cache
Optimize local buffer cache performance which is critical to many use cases - including packet IO. Main parts of the optimization are: * Local cache implemented as an array of buf_hdr pointers, instead of a linked list (which causes a lot of cache misses) * Alloc and free N buffers per operation All above steps are needed to demonstrate the performance upgrade. Some related pool functions (get_buf(), ret_buf(), etc) were moved from pool header to c source file, since those were actual local to the c source file. Also some unused pool variables are removed also. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic/include/odp_buffer_inlines.h')
-rw-r--r--platform/linux-generic/include/odp_buffer_inlines.h26
1 files changed, 4 insertions, 22 deletions
diff --git a/platform/linux-generic/include/odp_buffer_inlines.h b/platform/linux-generic/include/odp_buffer_inlines.h
index 3f4d9fdea..2b1ab42c3 100644
--- a/platform/linux-generic/include/odp_buffer_inlines.h
+++ b/platform/linux-generic/include/odp_buffer_inlines.h
@@ -56,30 +56,12 @@ static inline odp_buffer_hdr_t *odp_buf_to_hdr(odp_buffer_t buf)
(pool->pool_mdata_addr + (index * ODP_CACHE_LINE_SIZE));
}
-static inline uint32_t odp_buffer_refcount(odp_buffer_hdr_t *buf)
+static inline uint32_t pool_id_from_buf(odp_buffer_t buf)
{
- return odp_atomic_load_u32(&buf->ref_count);
-}
-
-static inline uint32_t odp_buffer_incr_refcount(odp_buffer_hdr_t *buf,
- uint32_t val)
-{
- return odp_atomic_fetch_add_u32(&buf->ref_count, val) + val;
-}
-
-static inline uint32_t odp_buffer_decr_refcount(odp_buffer_hdr_t *buf,
- uint32_t val)
-{
- uint32_t tmp;
-
- tmp = odp_atomic_fetch_sub_u32(&buf->ref_count, val);
+ odp_buffer_bits_t handle;
- if (tmp < val) {
- odp_atomic_fetch_add_u32(&buf->ref_count, val - tmp);
- return 0;
- } else {
- return tmp - val;
- }
+ handle.handle = buf;
+ return handle.pool_id;
}
static inline odp_buffer_hdr_t *validate_buf(odp_buffer_t buf)