DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zoltan Kiss <zoltan.kiss@linaro.org>
To: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] mempool: limit cache_size
Date: Mon, 18 May 2015 13:27:45 +0100	[thread overview]
Message-ID: <5559DAC1.8050106@linaro.org> (raw)
In-Reply-To: <1431543554-442-1-git-send-email-zoltan.kiss@linaro.org>

Hi,

Any opinion on this patch?

Regards,

Zoltan

On 13/05/15 19:59, Zoltan Kiss wrote:
> Otherwise cache_flushthresh can be bigger than n, and
> a consumer can starve others by keeping every element
> either in use or in the cache.
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> ---
>   lib/librte_mempool/rte_mempool.c | 3 ++-
>   lib/librte_mempool/rte_mempool.h | 2 +-
>   2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> index cf7ed76..ca6cd9c 100644
> --- a/lib/librte_mempool/rte_mempool.c
> +++ b/lib/librte_mempool/rte_mempool.c
> @@ -440,7 +440,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
>   	mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list);
>
>   	/* asked cache too big */
> -	if (cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE) {
> +	if (cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE ||
> +	    (uint32_t) cache_size * CACHE_FLUSHTHRESH_MULTIPLIER > n) {
>   		rte_errno = EINVAL;
>   		return NULL;
>   	}
> diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
> index 9001312..a4a9610 100644
> --- a/lib/librte_mempool/rte_mempool.h
> +++ b/lib/librte_mempool/rte_mempool.h
> @@ -468,7 +468,7 @@ typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *);
>    *   If cache_size is non-zero, the rte_mempool library will try to
>    *   limit the accesses to the common lockless pool, by maintaining a
>    *   per-lcore object cache. This argument must be lower or equal to
> - *   CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE. It is advised to choose
> + *   CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE and n / 1.5. It is advised to choose
>    *   cache_size to have "n modulo cache_size == 0": if this is
>    *   not the case, some elements will always stay in the pool and will
>    *   never be used. The access to the per-lcore table is of course
>

  reply	other threads:[~2015-05-18 12:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 18:59 Zoltan Kiss
2015-05-18 12:27 ` Zoltan Kiss [this message]
2015-05-18 12:31   ` Bruce Richardson
2015-05-18 12:41   ` Ananyev, Konstantin
2015-05-18 12:50     ` Zoltan Kiss
2015-05-18 13:14       ` Ananyev, Konstantin
2015-05-18 13:31         ` Zoltan Kiss
2015-05-18 14:13           ` Ananyev, Konstantin
2015-05-18 15:48             ` Zoltan Kiss

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=5559DAC1.8050106@linaro.org \
    --to=zoltan.kiss@linaro.org \
    --cc=dev@dpdk.org \
    /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).