[dpdk-dev] [PATCH v3 3/3] mempool: allow for user-owned mempool caches
Olivier Matz
olivier.matz at 6wind.com
Fri Jun 17 12:37:09 CEST 2016
On 06/16/2016 01:02 PM, Lazaros Koromilas wrote:
> 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)
These new functions should be added in the .map file, else it will
break the compilation in with shared_lib=y.
> 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>
> ---
> app/test/test_mempool.c | 94 ++++++++++++++++------
> app/test/test_mempool_perf.c | 70 ++++++++++++++---
> lib/librte_mempool/rte_mempool.c | 66 +++++++++++++++-
> lib/librte_mempool/rte_mempool.h | 163 ++++++++++++++++++++++++++++-----------
> 4 files changed, 310 insertions(+), 83 deletions(-)
>
> diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
> index 10d706f..723cd39 100644
> --- a/app/test/test_mempool.c
> +++ b/app/test/test_mempool.c
> @@ -79,6 +79,9 @@
> printf("test failed at %s():%d\n", __func__, __LINE__); \
> return -1; \
> } while (0)
> +#define LOG_ERR() do { \
> + printf("test failed at %s():%d\n", __func__, __LINE__); \
> + } while (0)
>
I see that the usage of this macro is always like this:
LOG_ERR();
ret = -1;
goto out;
What do you think of having:
#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() do { LOG_ERR(); ret = -1; goto out; } while (0)
Then use GOTO_ERR() when appropriate. It would also factorize
the printf.
More information about the dev
mailing list