DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lazaros Koromilas <l@nofutznetworks.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, Konstantin Ananyev <konstantin.ananyev@intel.com>,
	 David Hunt <david.hunt@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3 3/3] mempool: allow for user-owned mempool caches
Date: Sat, 18 Jun 2016 17:15:31 +0100	[thread overview]
Message-ID: <CAHPNE8iqtEBD4EdoGt6fOvgMTpdrxdn+nMoLq1ZeG_whn8K9+Q@mail.gmail.com> (raw)
In-Reply-To: <5763D2D5.3010209@6wind.com>

On Fri, Jun 17, 2016 at 11:37 AM, Olivier Matz <olivier.matz@6wind.com> wrote:
>
>
> 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.

Oops, thanks!

>> 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@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.

The downside of GOTO_ERR() is that it assumes a variable and a label
name. And you may need to have multiple labels 'out0', 'out1', etc for
the error path. How about:

#define GOTO_ERR(ret, out) do { LOG_ERR(); ret = -1; goto out; } while (0)

Lazaros.

  reply	other threads:[~2016-06-18 16:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16 11:02 [dpdk-dev] [PATCH v3 0/3] mempool: " Lazaros Koromilas
2016-06-16 11:02 ` [dpdk-dev] [PATCH v3 1/3] mempool: deprecate specific get/put functions Lazaros Koromilas
2016-06-16 11:02 ` [dpdk-dev] [PATCH v3 2/3] mempool: use bit flags instead of is_mp and is_mc Lazaros Koromilas
2016-06-17 10:36   ` Olivier Matz
2016-06-16 11:02 ` [dpdk-dev] [PATCH v3 3/3] mempool: allow for user-owned mempool caches Lazaros Koromilas
2016-06-17 10:37   ` Olivier Matz
2016-06-18 16:15     ` Lazaros Koromilas [this message]
2016-06-20  7:36       ` Olivier Matz
2016-06-17 10:36 ` [dpdk-dev] [PATCH v3 0/3] mempool: " Olivier Matz
2016-06-27 15:50 ` [dpdk-dev] [PATCH v4 " Olivier Matz
2016-06-27 15:50   ` [dpdk-dev] [PATCH v4 1/3] mempool: deprecate specific get/put functions Olivier Matz
2016-06-27 15:50   ` [dpdk-dev] [PATCH v4 2/3] mempool: use bit flags to set multi consumers or producers Olivier Matz
2016-06-27 15:50   ` [dpdk-dev] [PATCH v4 3/3] mempool: allow for user-owned mempool caches Olivier Matz
2016-06-28 17:20     ` Lazaros Koromilas
2016-06-27 15:52   ` [dpdk-dev] [PATCH v4 0/3] mempool: " Olivier MATZ
2016-06-28 23:47   ` [dpdk-dev] [PATCH v5 " Lazaros Koromilas
2016-06-28 23:47     ` [dpdk-dev] [PATCH v5 1/3] mempool: deprecate specific get and put functions Lazaros Koromilas
2016-06-28 23:47     ` [dpdk-dev] [PATCH v5 2/3] mempool: use bit flags to set multi consumers and producers Lazaros Koromilas
2016-06-28 23:47     ` [dpdk-dev] [PATCH v5 3/3] mempool: allow for user-owned mempool caches Lazaros Koromilas
2016-06-29 12:13       ` Olivier MATZ
2016-06-30  9:29     ` [dpdk-dev] [PATCH v5 0/3] mempool: " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHPNE8iqtEBD4EdoGt6fOvgMTpdrxdn+nMoLq1ZeG_whn8K9+Q@mail.gmail.com \
    --to=l@nofutznetworks.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=olivier.matz@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).