From patchwork Tue Nov 10 15:41:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 83904 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62DAEA04DB; Tue, 10 Nov 2020 16:41:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4048A323C; Tue, 10 Nov 2020 16:41:42 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7F39B4CA6 for ; Tue, 10 Nov 2020 16:41:39 +0100 (CET) IronPort-SDR: Svt3qx0imzzCgRy+S/g312KhAjpE/unnjJ0JGfgBcTE3iZTLo3bpDfXFi9uYNLBEEU92RaDdr6 Sp2AstA2A1bg== X-IronPort-AV: E=McAfee;i="6000,8403,9801"; a="170151179" X-IronPort-AV: E=Sophos;i="5.77,466,1596524400"; d="scan'208";a="170151179" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2020 07:41:33 -0800 IronPort-SDR: 5iwjEzE+k7+Vh94nj2I+dMiUYvrWzVpKgN7QQqPGFN/FRc1OP6dWkKQGD2h7dY7e+ZEtk0kOaV RXUZmeN4QMUw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,466,1596524400"; d="scan'208";a="529839435" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.52]) by fmsmga006.fm.intel.com with ESMTP; 10 Nov 2020 07:41:31 -0800 From: Anatoly Burakov To: dev@dpdk.org Cc: michallinuxstuff@gmail.com Date: Tue, 10 Nov 2020 15:41:36 +0000 Message-Id: <11a0d8735a3ee33d02bc57dc702995486051f5d6.1605022892.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH 21.02] eal/linux: improve no hugepages logging X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When no hugepages are found, we log a message about it, but we never specify on which node. We also implicitly declare the page size based on the directory name, but that's not very user friendly. Fix both by changing the text of the message to note the NUMA node (if applicable) and explicitly mention page size in kilobytes. Signed-off-by: Anatoly Burakov Reviewed-by: David Marchand --- lib/librte_eal/linux/eal_hugepage_info.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/librte_eal/linux/eal_hugepage_info.c b/lib/librte_eal/linux/eal_hugepage_info.c index 4191af6a21..d97792cade 100644 --- a/lib/librte_eal/linux/eal_hugepage_info.c +++ b/lib/librte_eal/linux/eal_hugepage_info.c @@ -84,7 +84,7 @@ static int get_hp_sysfs_value(const char *subdir, const char *file, unsigned lon /* this function is only called from eal_hugepage_info_init which itself * is only called from a primary process */ static uint32_t -get_num_hugepages(const char *subdir) +get_num_hugepages(const char *subdir, size_t sz) { unsigned long resv_pages, num_pages, over_pages, surplus_pages; const char *nr_hp_file = "free_hugepages"; @@ -117,8 +117,8 @@ get_num_hugepages(const char *subdir) over_pages = 0; if (num_pages == 0 && over_pages == 0) - RTE_LOG(WARNING, EAL, "No available hugepages reported in %s\n", - subdir); + RTE_LOG(WARNING, EAL, "No available %zu kB hugepages reported\n", + sz >> 10); num_pages += over_pages; if (num_pages < over_pages) /* overflow */ @@ -133,7 +133,7 @@ get_num_hugepages(const char *subdir) } static uint32_t -get_num_hugepages_on_node(const char *subdir, unsigned int socket) +get_num_hugepages_on_node(const char *subdir, unsigned int socket, size_t sz) { char path[PATH_MAX], socketpath[PATH_MAX]; DIR *socketdir; @@ -158,8 +158,8 @@ get_num_hugepages_on_node(const char *subdir, unsigned int socket) return 0; if (num_pages == 0) - RTE_LOG(WARNING, EAL, "No free hugepages reported in %s\n", - subdir); + RTE_LOG(WARNING, EAL, "No free %zu kB hugepages reported on node %u\n", + sz >> 10, socket); /* * we want to return a uint32_t and more than this looks suspicious @@ -361,7 +361,8 @@ calc_num_pages(struct hugepage_info *hpi, struct dirent *dirent) int socket = rte_socket_id_by_idx(i); unsigned int num_pages = get_num_hugepages_on_node( - dirent->d_name, socket); + dirent->d_name, socket, + hpi->hugepage_sz); hpi->num_pages[socket] = num_pages; total_pages += num_pages; } @@ -370,7 +371,8 @@ calc_num_pages(struct hugepage_info *hpi, struct dirent *dirent) * back to old way */ if (total_pages == 0) { - hpi->num_pages[0] = get_num_hugepages(dirent->d_name); + hpi->num_pages[0] = get_num_hugepages(dirent->d_name, + hpi->hugepage_sz); #ifndef RTE_ARCH_64 /* for 32-bit systems, limit number of hugepages to @@ -418,7 +420,8 @@ hugepage_info_init(void) hpi->hugedir, sizeof(hpi->hugedir)) < 0) { uint32_t num_pages; - num_pages = get_num_hugepages(dirent->d_name); + num_pages = get_num_hugepages(dirent->d_name, + hpi->hugepage_sz); if (num_pages > 0) RTE_LOG(NOTICE, EAL, "%" PRIu32 " hugepages of size "