From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by dpdk.org (Postfix) with ESMTP id 0199B678B for ; Fri, 18 Apr 2014 14:56:50 +0200 (CEST) Received: by mail-wi0-f172.google.com with SMTP id hi2so684307wib.5 for ; Fri, 18 Apr 2014 05:56:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jbSf/uteP8wTA8WMWJEQfs0XmEhS4/rww7Oieei2WU0=; b=eGnC0DbFIrL+O9yDSBQGJ66Lhuq4aeG/m6Xj/LP17b1mbSsaTHLEWMN4XciDIWw+YE CxNI0siJmaqoOwG384WdPVVl8meYtt55RzwFm6bALVqwAgED10U47wtDYTUaWVGuLGCb 2z1JKlbgoFlLS+D0u52trdnozaZE7YNFe72bK1X6cBtNpeORULCJvUpzXJdm4ZBtj6G9 JHECHgyvcab6mBpa7Q7dHb/ZeqOqebh7F8SMMh2Pe0QcRQsXSMDlNKzJNc2ryPBHWmav VAG6Cc6QSPLtt8k8/59QVCMeGzoBVDM7CLn+X+EpSmu7W9Reh0pNvcVn9IrZ4YlAgS8J Sf7w== X-Gm-Message-State: ALoCoQnRm6imTT8K+GAJhKVAH1/+V7wowc1djz424LwpJz2K1VyqhJobmLkOC3j//E54sd08odf5 X-Received: by 10.194.90.107 with SMTP id bv11mr16183613wjb.11.1397825812036; Fri, 18 Apr 2014 05:56:52 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id h1sm43508961wjy.7.2014.04.18.05.56.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Apr 2014 05:56:51 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Fri, 18 Apr 2014 14:56:17 +0200 Message-Id: <1397825778-24334-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1397825778-24334-1-git-send-email-david.marchand@6wind.com> References: <20140415144440.GD3557@hmsreliant.think-freely.org> <1397825778-24334-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 1/2] malloc: get rid of numa_socket field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2014 12:56:51 -0000 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 --- 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