DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 21.02] eal/linux: improve no hugepages logging
@ 2020-11-10 15:41 Anatoly Burakov
  2021-01-12 11:17 ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Anatoly Burakov @ 2020-11-10 15:41 UTC (permalink / raw)
  To: dev; +Cc: michallinuxstuff

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 <anatoly.burakov@intel.com>
---
 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 "
-- 
2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH 21.02] eal/linux: improve no hugepages logging
  2020-11-10 15:41 [dpdk-dev] [PATCH 21.02] eal/linux: improve no hugepages logging Anatoly Burakov
@ 2021-01-12 11:17 ` David Marchand
  2021-01-19 12:13   ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2021-01-12 11:17 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, michallinuxstuff

On Tue, Nov 10, 2020 at 4:41 PM Anatoly Burakov
<anatoly.burakov@intel.com> wrote:
>
> 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.

Not sure it is worth aligning but another log uses bytes.
From my tests (after unmounting 2M hugetlbfs mountpoint):
EAL: 512 hugepages of size 2097152 reserved, but no mounted hugetlbfs
found for that size

>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

The rest lgtm.

Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH 21.02] eal/linux: improve no hugepages logging
  2021-01-12 11:17 ` David Marchand
@ 2021-01-19 12:13   ` David Marchand
  0 siblings, 0 replies; 3+ messages in thread
From: David Marchand @ 2021-01-19 12:13 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, michallinuxstuff

On Tue, Jan 12, 2021 at 12:17 PM David Marchand
<david.marchand@redhat.com> wrote:
> On Tue, Nov 10, 2020 at 4:41 PM Anatoly Burakov
> <anatoly.burakov@intel.com> wrote:
> >
> > 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 <anatoly.burakov@intel.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-19 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 15:41 [dpdk-dev] [PATCH 21.02] eal/linux: improve no hugepages logging Anatoly Burakov
2021-01-12 11:17 ` David Marchand
2021-01-19 12:13   ` David Marchand

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git