From: Olivier MATZ <olivier.matz@6wind.com>
To: "Wiles, Keith" <keith.wiles@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v2] mempool: reduce rte_mempool structure size
Date: Wed, 10 Feb 2016 21:06:10 +0100 [thread overview]
Message-ID: <56BB9832.10302@6wind.com> (raw)
In-Reply-To: <BD003B42-A267-4BF3-8B14-BCA8CC75DE47@intel.com>
Hi Keith,
On 02/10/2016 07:35 PM, Wiles, Keith wrote:
>>> @@ -672,6 +704,24 @@ rte_mempool_count(const struct rte_mempool *mp)
>>> static unsigned
>>> rte_mempool_dump_cache(FILE *f, const struct rte_mempool *mp)
>>> {
>>> +#ifdef RTE_NEXT_ABI
>>> + unsigned lcore_id;
>>> + unsigned count = 0;
>>> + unsigned cache_count;
>>> +
>>> + fprintf(f, " cache infos:\n");
>>> + fprintf(f, " cache_size=%"PRIu32"\n", mp->cache_size);
>>> + if (mp->cache_size == 0)
>>> + return count;
>>> +
>>> + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
>>> + cache_count = mp->local_cache[lcore_id].len;
>>> + fprintf(f, " cache_count[%u]=%u\n", lcore_id, cache_count);
>>> + count += cache_count;
>>> + }
>>> + fprintf(f, " total_cache_count=%u\n", count);
>>> + return count;
>>> +#else
>>> #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
>>> unsigned lcore_id;
>>> unsigned count = 0;
>>
>> I think in this case we could avoid to duplicate the code without
>> beeing unclear by using the proper #ifdefs:
>>
>> #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0 || defined(RTE_NEXT_ABI)
>> /* common code */
>> #ifdef RTE_NEXT_ABI
>> if (mp->cache_size == 0)
>> return count;
>> #endif
>> /* common code */
>> #else
>> ...
>> #endif
>
> Started looking at this change and the problem is I want to remove the ifdef RTE_MEMPOOL.. As well as the #else/#endif code. If I do as you suggest it does not appear to be clearer when someone goes back to remove the code, they may think the #ifdef RTE_MEMPOOL/#else/#endif are still required.
OK, makes sense.
>>> @@ -755,19 +793,25 @@ static inline void __attribute__((always_inline))
>>> __mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table,
>>> unsigned n, int is_mp)
>>> {
>>> +#ifndef RTE_NEXT_ABI /* Note: ifndef */
>>> #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
>>> +#endif /* RTE_NEXT_ABI */
>>> struct rte_mempool_cache *cache;
>>> uint32_t index;
>>> void **cache_objs;
>>> unsigned lcore_id = rte_lcore_id();
>>> uint32_t cache_size = mp->cache_size;
>>> uint32_t flushthresh = mp->cache_flushthresh;
>>> +#ifndef RTE_NEXT_ABI /* Note: ifndef */
>>> #endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */
>>> +#endif /* RTE_NEXT_ABI */
>>
>> this looks strange... I think it does not work properly.
>> Why not
>> #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0 || defined(RTE_NEXT_ABI)
>
> Yes I agree the ifndef looks strange, but it should work as we want to remove the #ifdef RTE_MEMPOOL/#endif lines. This was the reason for the comment that it was a ifndef.
It's not only strange, it's also probably not what you want to do:
#ifndef RTE_NEXT_ABI /* Note: ifndef */
#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
#endif /* RTE_NEXT_ABI */
...
Here, the #endif corresponds to the second #if, not the first #ifdef.
Regards,
Olivier
next prev parent reply other threads:[~2016-02-10 20:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 23:02 [PATCH] mempool: Reduce rte_mempool structure size Keith Wiles
2016-02-03 17:11 ` Ananyev, Konstantin
2016-02-08 11:02 ` Olivier MATZ
2016-02-08 15:57 ` Wiles, Keith
2016-02-09 17:30 ` [PATCH v2] mempool: reduce " Keith Wiles
2016-02-10 16:59 ` Olivier MATZ
2016-02-10 17:22 ` Wiles, Keith
2016-02-10 18:35 ` Wiles, Keith
2016-02-10 20:06 ` Olivier MATZ [this message]
2016-02-10 21:18 ` [PATCH v3] " Keith Wiles
2016-02-12 11:23 ` Panu Matilainen
2016-02-12 13:57 ` Thomas Monjalon
2016-02-12 14:19 ` Panu Matilainen
2016-02-12 15:07 ` Wiles, Keith
2016-02-12 15:38 ` Thomas Monjalon
2016-02-12 15:50 ` Olivier MATZ
2016-02-12 15:58 ` Wiles, Keith
2016-02-15 9:58 ` Hunt, David
2016-02-15 10:15 ` Olivier MATZ
2016-02-15 10:21 ` Hunt, David
2016-02-15 12:31 ` Olivier MATZ
2016-02-12 15:54 ` Wiles, Keith
2016-02-12 18:36 ` [PATCH v4] " Keith Wiles
2016-02-15 9:20 ` Olivier MATZ
2016-04-14 9:42 ` [PATCH v5] " Olivier Matz
2016-04-14 13:28 ` Wiles, Keith
2016-04-14 13:43 ` Olivier MATZ
2016-04-14 13:53 ` Wiles, Keith
2016-05-17 5:31 ` Thomas Monjalon
-- strict thread matches above, loose matches on Subject: below --
2016-02-10 18:01 [PATCH v2] " Wiles, Keith
2016-02-10 18:02 ` Thomas Monjalon
2016-02-12 11:52 ` Panu Matilainen
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=56BB9832.10302@6wind.com \
--to=olivier.matz@6wind.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.