All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
To: David Marchand <david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH 1/2] malloc: get rid of numa_socket field
Date: Fri, 18 Apr 2014 09:08:42 -0400	[thread overview]
Message-ID: <20140418130842.GA4053@localhost.localdomain> (raw)
In-Reply-To: <1397825778-24334-2-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

On Fri, Apr 18, 2014 at 02:56:17PM +0200, David Marchand wrote:
> We don't really need this field as it is only used when creating the memzone
> object associated to this heap.
> 
> Signed-off-by: David Marchand <david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Acked-by: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>

> ---
>  lib/librte_eal/common/include/rte_malloc_heap.h |    1 -
>  lib/librte_malloc/malloc_heap.c                 |   13 +++++--------
>  2 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_malloc_heap.h b/lib/librte_eal/common/include/rte_malloc_heap.h
> index d9e959d..ea2a3f5 100644
> --- a/lib/librte_eal/common/include/rte_malloc_heap.h
> +++ b/lib/librte_eal/common/include/rte_malloc_heap.h
> @@ -48,7 +48,6 @@ enum heap_state {
>   */
>  struct malloc_heap {
>  	enum heap_state volatile initialised;
> -	unsigned numa_socket;
>  	rte_spinlock_t lock;
>  	struct malloc_elem * volatile free_head;
>  	unsigned mz_count;
> diff --git a/lib/librte_malloc/malloc_heap.c b/lib/librte_malloc/malloc_heap.c
> index f4a0294..375f212 100644
> --- a/lib/librte_malloc/malloc_heap.c
> +++ b/lib/librte_malloc/malloc_heap.c
> @@ -82,6 +82,8 @@ malloc_heap_add_memzone(struct malloc_heap *heap, size_t size, unsigned align)
>  	/* ensure the data we want to allocate will fit in the memzone */
>  	const size_t min_size = size + align + MALLOC_ELEM_OVERHEAD * 2;
>  	const struct rte_memzone *mz = NULL;
> +	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
> +	unsigned numa_socket = heap - mcfg->malloc_heaps;
>  
>  	size_t mz_size = min_size;
>  	if (mz_size < block_size)
> @@ -89,14 +91,14 @@ malloc_heap_add_memzone(struct malloc_heap *heap, size_t size, unsigned align)
>  
>  	char mz_name[RTE_MEMZONE_NAMESIZE];
>  	rte_snprintf(mz_name, sizeof(mz_name), "MALLOC_S%u_HEAP_%u",
> -			heap->numa_socket, heap->mz_count++);
> +		     numa_socket, heap->mz_count++);
>  
>  	/* try getting a block. if we fail and we don't need as big a block
>  	 * as given in the config, we can shrink our request and try again
>  	 */
>  	do {
> -		mz = rte_memzone_reserve(mz_name, mz_size,
> -				heap->numa_socket, mz_flags);
> +		mz = rte_memzone_reserve(mz_name, mz_size, numa_socket,
> +					 mz_flags);
>  		if (mz == NULL)
>  			mz_size /= 2;
>  	} while (mz == NULL && mz_size > min_size);
> @@ -141,11 +143,6 @@ malloc_heap_init(struct malloc_heap *heap)
>  			heap->mz_count = 0;
>  			heap->alloc_count = 0;
>  			heap->total_size = 0;
> -			/*
> -			 * Find NUMA socket of heap that is being initialised, so that
> -			 * malloc_heaps[n].numa_socket == n
> -			 */
> -			heap->numa_socket = heap - mcfg->malloc_heaps;
>  			rte_spinlock_init(&heap->lock);
>  			heap->initialised = INITIALISED;
>  		}
> -- 
> 1.7.10.4
> 
> 

  parent reply	other threads:[~2014-04-18 13:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 13:50 [PATCH 1/2] mem: add write memory barrier before changing heap state David Marchand
     [not found] ` <1397569859-14460-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-15 13:50   ` [PATCH 2/2] mem: fix initialization check for malloc heap David Marchand
2014-04-15 14:08   ` [PATCH 1/2] mem: add write memory barrier before changing heap state Richardson, Bruce
     [not found]     ` <59AF69C657FD0841A61C55336867B5B01A9FCCFF-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-04-16  8:55       ` didier.pallard
2014-04-15 14:44   ` Neil Horman
     [not found]     ` <20140415144440.GD3557-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-04-18 12:56       ` [PATCH 0/2] rework heap initialisation David Marchand
     [not found]         ` <1397825778-24334-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-18 12:56           ` [PATCH 1/2] malloc: get rid of numa_socket field David Marchand
     [not found]             ` <1397825778-24334-2-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-18 13:08               ` Neil Horman [this message]
     [not found]                 ` <20140418130842.GA4053-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-04-30  9:46                   ` Thomas Monjalon
2014-04-18 12:56           ` [PATCH 2/2] malloc: simplify heap initialisation David Marchand
     [not found]             ` <1397825778-24334-3-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-18 13:09               ` Neil Horman
     [not found]                 ` <20140418130919.GB4053-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-04-30  9:47                   ` 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=20140418130842.GA4053@localhost.localdomain \
    --to=nhorman-2xusbdqka4r54taoqtywwq@public.gmane.org \
    --cc=david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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 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.