From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15AD145DAB; Tue, 26 Nov 2024 14:15:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2DB840E72; Tue, 26 Nov 2024 14:15:03 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by mails.dpdk.org (Postfix) with ESMTP id 75F9140E4C for ; Tue, 26 Nov 2024 14:14:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732626900; x=1764162900; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=RqYO+pZ+wvOyxCXlYNRNCI+QlKDA5qbn1UUh558F2xk=; b=cXwOokymcg4WTxZEyMkirWd88VRBG/q4svJWJaLJU9/qBd7iul3hSs8j GaO9jg6RNErEya093W01XEJnbEwTOTRrsuB7sTXPUv49nGT9dFabPKeRN Pi7+XSgPghNF+nIkz34jHoOHF9cY82wsbrShvGYNnTKPb+ei4kLegiRAU 5Os8qEN6E/jKNl2emj9jfVnZMATpHwk1TY8UEbD+Tp7vfsjR6b1vPdlrC uTNMLxlAWi4bLj94kTHEAMjEOz3haMIRRR/WGnVlX6H78xCVn5J/sCli/ 2fFRHbfn3HESnZ+TYBfHL4l8Ze1nJTtw6dTiDtEgcGq1M+W3v267qOGn9 Q==; X-CSE-ConnectionGUID: 8ZvGchciQzS/Qem/StyeQA== X-CSE-MsgGUID: k2OpjLMzQXCElGgCyrU6Xw== X-IronPort-AV: E=McAfee;i="6700,10204,11268"; a="36447037" X-IronPort-AV: E=Sophos;i="6.12,186,1728975600"; d="scan'208";a="36447037" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2024 05:14:59 -0800 X-CSE-ConnectionGUID: cP7ja12SRXmxbKq3+N/KcA== X-CSE-MsgGUID: /a48K19bR4OYejp2xwElcg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,186,1728975600"; d="scan'208";a="92013311" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa007.jf.intel.com with ESMTP; 26 Nov 2024 05:14:58 -0800 From: Anatoly Burakov To: dev@dpdk.org, Tyler Retzlaff , Bruce Richardson , Dmitry Kozlyuk Subject: [PATCH v1 3/4] eal: rename socket ID to NUMA ID in internal config Date: Tue, 26 Nov 2024 13:14:49 +0000 Message-ID: <0cacb7d0789f03163ed32faa9d6919cbfe690b52.1732626792.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch renames socket ID-related fields in internal EAL config structure to refer to NUMA ID instead. No user-facing API's are changed. Signed-off-by: Anatoly Burakov --- lib/eal/common/eal_common_dynmem.c | 14 +++++++------- lib/eal/common/eal_common_options.c | 16 ++++++++-------- lib/eal/common/eal_internal_cfg.h | 10 +++++----- lib/eal/common/malloc_heap.c | 2 +- lib/eal/freebsd/eal.c | 2 +- lib/eal/linux/eal.c | 10 +++++----- lib/eal/linux/eal_memory.c | 22 +++++++++++----------- lib/eal/windows/eal.c | 2 +- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/eal/common/eal_common_dynmem.c b/lib/eal/common/eal_common_dynmem.c index b4dc231940..4377af5aab 100644 --- a/lib/eal/common/eal_common_dynmem.c +++ b/lib/eal/common/eal_common_dynmem.c @@ -264,9 +264,9 @@ eal_dynmem_hugepage_init(void) #endif } - /* make a copy of socket_mem, needed for balanced allocation. */ + /* make a copy of numa_mem, needed for balanced allocation. */ for (hp_sz_idx = 0; hp_sz_idx < RTE_MAX_NUMA_NODES; hp_sz_idx++) - memory[hp_sz_idx] = internal_conf->socket_mem[hp_sz_idx]; + memory[hp_sz_idx] = internal_conf->numa_mem[hp_sz_idx]; /* calculate final number of pages */ if (eal_dynmem_calc_num_pages_per_socket(memory, @@ -334,10 +334,10 @@ eal_dynmem_hugepage_init(void) } /* if socket limits were specified, set them */ - if (internal_conf->force_socket_limits) { + if (internal_conf->force_numa_limits) { unsigned int i; for (i = 0; i < RTE_MAX_NUMA_NODES; i++) { - uint64_t limit = internal_conf->socket_limit[i]; + uint64_t limit = internal_conf->numa_limit[i]; if (limit == 0) continue; if (rte_mem_alloc_validator_register("socket-limit", @@ -382,7 +382,7 @@ eal_dynmem_calc_num_pages_per_socket( return -1; /* if specific memory amounts per socket weren't requested */ - if (internal_conf->force_sockets == 0) { + if (internal_conf->force_numa == 0) { size_t total_size; #ifdef RTE_ARCH_64 int cpu_per_socket[RTE_MAX_NUMA_NODES]; @@ -509,10 +509,10 @@ eal_dynmem_calc_num_pages_per_socket( /* if we didn't satisfy all memory requirements per socket */ if (memory[socket] > 0 && - internal_conf->socket_mem[socket] != 0) { + internal_conf->numa_mem[socket] != 0) { /* to prevent icc errors */ requested = (unsigned int)( - internal_conf->socket_mem[socket] / 0x100000); + internal_conf->numa_mem[socket] / 0x100000); available = requested - ((unsigned int)(memory[socket] / 0x100000)); EAL_LOG(ERR, "Not enough memory available on " diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index 79db9a47dd..ab95674c2e 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -334,14 +334,14 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->hugepage_dir = NULL; internal_cfg->hugepage_file.unlink_before_mapping = false; internal_cfg->hugepage_file.unlink_existing = true; - internal_cfg->force_sockets = 0; + internal_cfg->force_numa = 0; /* zero out the NUMA config */ for (i = 0; i < RTE_MAX_NUMA_NODES; i++) - internal_cfg->socket_mem[i] = 0; - internal_cfg->force_socket_limits = 0; + internal_cfg->numa_mem[i] = 0; + internal_cfg->force_numa_limits = 0; /* zero out the NUMA limits config */ for (i = 0; i < RTE_MAX_NUMA_NODES; i++) - internal_cfg->socket_limit[i] = 0; + internal_cfg->numa_limit[i] = 0; /* zero out hugedir descriptors */ for (i = 0; i < MAX_HUGEPAGE_SIZES; i++) { memset(&internal_cfg->hugepage_info[i], 0, @@ -2065,7 +2065,7 @@ eal_adjust_config(struct internal_config *internal_cfg) /* if no memory amounts were requested, this will result in 0 and * will be overridden later, right after eal_hugepage_info_init() */ for (i = 0; i < RTE_MAX_NUMA_NODES; i++) - internal_cfg->memory += internal_cfg->socket_mem[i]; + internal_cfg->memory += internal_cfg->numa_mem[i]; return 0; } @@ -2106,12 +2106,12 @@ eal_check_common_options(struct internal_config *internal_cfg) "option"); return -1; } - if (mem_parsed && internal_cfg->force_sockets == 1) { + if (mem_parsed && internal_cfg->force_numa == 1) { EAL_LOG(ERR, "Options -m and --"OPT_SOCKET_MEM" cannot " "be specified at the same time"); return -1; } - if (internal_cfg->no_hugetlbfs && internal_cfg->force_sockets == 1) { + if (internal_cfg->no_hugetlbfs && internal_cfg->force_numa == 1) { EAL_LOG(ERR, "Option --"OPT_SOCKET_MEM" cannot " "be specified together with --"OPT_NO_HUGE); return -1; @@ -2129,7 +2129,7 @@ eal_check_common_options(struct internal_config *internal_cfg) "be specified together with --"OPT_NO_HUGE); return -1; } - if (internal_conf->force_socket_limits && internal_conf->legacy_mem) { + if (internal_conf->force_numa_limits && internal_conf->legacy_mem) { EAL_LOG(ERR, "Option --"OPT_SOCKET_LIMIT " is only supported in non-legacy memory mode"); } diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h index f53ab8b4aa..97a68f00f6 100644 --- a/lib/eal/common/eal_internal_cfg.h +++ b/lib/eal/common/eal_internal_cfg.h @@ -68,11 +68,11 @@ struct internal_config { */ volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */ volatile enum rte_proc_type_t process_type; /**< multi-process proc type */ - /** true to try allocating memory on specific sockets */ - volatile unsigned force_sockets; - volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */ - volatile unsigned force_socket_limits; - volatile uint64_t socket_limit[RTE_MAX_NUMA_NODES]; /**< limit amount of memory per socket */ + /** true to try allocating memory on specific NUMA nodes */ + volatile unsigned force_numa; + volatile uint64_t numa_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */ + volatile unsigned force_numa_limits; + volatile uint64_t numa_limit[RTE_MAX_NUMA_NODES]; /**< limit amount of memory per socket */ uintptr_t base_virtaddr; /**< base address to try and reserve memory from */ volatile unsigned legacy_mem; /**< true to enable legacy memory behavior (no dynamic allocation, diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 058aaf4209..f87a947a42 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -711,7 +711,7 @@ malloc_get_numa_socket(void) /* for control threads, return first socket where memory is available */ for (idx = 0; idx < rte_socket_count(); idx++) { socket_id = rte_socket_id_by_idx(idx); - if (conf->socket_mem[socket_id] != 0) + if (conf->numa_mem[socket_id] != 0) return socket_id; } /* We couldn't quickly find a NUMA node where memory was available, diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index a96bbf5836..9d1fedc08e 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -713,7 +713,7 @@ rte_eal_init(int argc, char **argv) } } - if (internal_conf->memory == 0 && internal_conf->force_sockets == 0) { + if (internal_conf->memory == 0 && internal_conf->force_numa == 0) { if (internal_conf->no_hugetlbfs) internal_conf->memory = MEMSIZE_IF_NO_HUGE_PAGE; else diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index a6220524a4..4b8f855c00 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -657,26 +657,26 @@ eal_parse_args(int argc, char **argv) } case OPT_SOCKET_MEM_NUM: if (eal_parse_socket_arg(optarg, - internal_conf->socket_mem) < 0) { + internal_conf->numa_mem) < 0) { EAL_LOG(ERR, "invalid parameters for --" OPT_SOCKET_MEM); eal_usage(prgname); ret = -1; goto out; } - internal_conf->force_sockets = 1; + internal_conf->force_numa = 1; break; case OPT_SOCKET_LIMIT_NUM: if (eal_parse_socket_arg(optarg, - internal_conf->socket_limit) < 0) { + internal_conf->numa_limit) < 0) { EAL_LOG(ERR, "invalid parameters for --" OPT_SOCKET_LIMIT); eal_usage(prgname); ret = -1; goto out; } - internal_conf->force_socket_limits = 1; + internal_conf->force_numa_limits = 1; break; case OPT_VFIO_INTR_NUM: @@ -1094,7 +1094,7 @@ rte_eal_init(int argc, char **argv) } } - if (internal_conf->memory == 0 && internal_conf->force_sockets == 0) { + if (internal_conf->memory == 0 && internal_conf->force_numa == 0) { if (internal_conf->no_hugetlbfs) internal_conf->memory = MEMSIZE_IF_NO_HUGE_PAGE; } diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c index 45879ca743..45776ed33d 100644 --- a/lib/eal/linux/eal_memory.c +++ b/lib/eal/linux/eal_memory.c @@ -282,7 +282,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, oldpolicy = MPOL_DEFAULT; } for (i = 0; i < RTE_MAX_NUMA_NODES; i++) - if (internal_conf->socket_mem[i]) + if (internal_conf->numa_mem[i]) maxnode = i + 1; } #endif @@ -301,7 +301,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi, if (j == maxnode) { node_id = (node_id + 1) % maxnode; - while (!internal_conf->socket_mem[node_id]) { + while (!internal_conf->numa_mem[node_id]) { node_id++; node_id %= maxnode; } @@ -1269,9 +1269,9 @@ eal_legacy_hugepage_init(void) huge_register_sigbus(); - /* make a copy of socket_mem, needed for balanced allocation. */ + /* make a copy of numa_mem, needed for balanced allocation. */ for (i = 0; i < RTE_MAX_NUMA_NODES; i++) - memory[i] = internal_conf->socket_mem[i]; + memory[i] = internal_conf->numa_mem[i]; /* map all hugepages and sort them */ for (i = 0; i < (int)internal_conf->num_hugepage_sizes; i++) { @@ -1339,7 +1339,7 @@ eal_legacy_hugepage_init(void) huge_recover_sigbus(); - if (internal_conf->memory == 0 && internal_conf->force_sockets == 0) + if (internal_conf->memory == 0 && internal_conf->force_numa == 0) internal_conf->memory = eal_get_hugepage_mem_size(); nr_hugefiles = nr_hugepages; @@ -1365,9 +1365,9 @@ eal_legacy_hugepage_init(void) } } - /* make a copy of socket_mem, needed for number of pages calculation */ + /* make a copy of numa_mem, needed for number of pages calculation */ for (i = 0; i < RTE_MAX_NUMA_NODES; i++) - memory[i] = internal_conf->socket_mem[i]; + memory[i] = internal_conf->numa_mem[i]; /* calculate final number of pages */ nr_hugepages = eal_dynmem_calc_num_pages_per_socket(memory, @@ -1722,12 +1722,12 @@ memseg_primary_init_32(void) */ active_sockets = 0; total_requested_mem = 0; - if (internal_conf->force_sockets) + if (internal_conf->force_numa) for (i = 0; i < rte_socket_count(); i++) { uint64_t mem; socket_id = rte_socket_id_by_idx(i); - mem = internal_conf->socket_mem[socket_id]; + mem = internal_conf->numa_mem[socket_id]; if (mem == 0) continue; @@ -1779,7 +1779,7 @@ memseg_primary_init_32(void) /* if we didn't specifically request memory on this socket */ skip = active_sockets != 0 && - internal_conf->socket_mem[socket_id] == 0; + internal_conf->numa_mem[socket_id] == 0; /* ...or if we didn't specifically request memory on *any* * socket, and this is not main lcore */ @@ -1794,7 +1794,7 @@ memseg_primary_init_32(void) /* max amount of memory on this socket */ max_socket_mem = (active_sockets != 0 ? - internal_conf->socket_mem[socket_id] : + internal_conf->numa_mem[socket_id] : internal_conf->memory) + extra_mem_per_socket; cur_socket_mem = 0; diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index 5cdc053a02..612ce13a90 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -302,7 +302,7 @@ rte_eal_init(int argc, char **argv) return -1; } - if (internal_conf->memory == 0 && !internal_conf->force_sockets) { + if (internal_conf->memory == 0 && !internal_conf->force_numa) { if (internal_conf->no_hugetlbfs) internal_conf->memory = MEMSIZE_IF_NO_HUGE_PAGE; } -- 2.43.5