[dpdk-dev] [PATCH v4 3/3] mempool: allow for user-owned mempool caches
Lazaros Koromilas
l at nofutznetworks.com
Tue Jun 28 19:20:43 CEST 2016
Hi Olivier, thanks for fixing those, just one comment below
On Mon, Jun 27, 2016 at 4:50 PM, Olivier Matz <olivier.matz at 6wind.com> wrote:
> From: Lazaros Koromilas <l at nofutznetworks.com>
>
> The mempool cache is only available to EAL threads as a per-lcore
> resource. Change this so that the user can create and provide their own
> cache on mempool get and put operations. This works with non-EAL threads
> too. This commit introduces the new API calls:
>
> rte_mempool_cache_create(size, socket_id)
> rte_mempool_cache_free(cache)
> rte_mempool_cache_flush(cache, mp)
> rte_mempool_default_cache(mp, lcore_id)
>
> Changes the API calls:
>
> rte_mempool_generic_put(mp, obj_table, n, cache, flags)
> rte_mempool_generic_get(mp, obj_table, n, cache, flags)
>
> The cache-oblivious API calls use the per-lcore default local cache.
>
> Signed-off-by: Lazaros Koromilas <l at nofutznetworks.com>
> Acked-by: Olivier Matz <olivier.matz at 6wind.com>
> ---
> app/test/test_mempool.c | 75 +++++++++----
> app/test/test_mempool_perf.c | 70 ++++++++++---
> lib/librte_mempool/rte_mempool.c | 66 +++++++++++-
> lib/librte_mempool/rte_mempool.h | 163 +++++++++++++++++++++--------
> lib/librte_mempool/rte_mempool_version.map | 4 +
> 5 files changed, 296 insertions(+), 82 deletions(-)
>
> diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
> index 55c2cbc..5b3c754 100644
> --- a/app/test/test_mempool.c
> +++ b/app/test/test_mempool.c
> @@ -75,10 +75,18 @@
> #define MAX_KEEP 16
> #define MEMPOOL_SIZE ((rte_lcore_count()*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE))-1)
>
> -#define RET_ERR() do { \
> +#define LOG_ERR() do { \
> printf("test failed at %s():%d\n", __func__, __LINE__); \
> + } while (0)
> +#define RET_ERR() do { \
> + LOG_ERR(); \
> return -1; \
> } while (0)
> +#define GOTO_ERR(err, label) do { \
> + LOG_ERR(); \
> + ret = err; \
> + goto label; \
> + } while (0)
Here, GOTO_ERR still assumes a variable named ret in the function and
has the value as an argument while RET_ERR always returns -1. I'd
changed it to use -1:
#define GOTO_ERR(retvar, label) do { LOG_ERR(); retvar = -1; goto
label; } while (0)
Should I do it like that and also quickly add the documentation in a v5?
Thanks,
Lazaros.
More information about the dev
mailing list