Thread (13 messages) 13 messages, 5 authors, 2023-06-29

Re: [dpdk-dev] [PATCH] test: make hugepage check more robust under Linux

From: Thomas Monjalon <hidden>
Date: 2021-03-17 14:57:42

17/03/2021 15:44, Aaron Conole:
The hugepage test really needs to check multiple things on Linux:

1. Are hugepages reserved in the system?

2. Is the hugepage mountpoint available so that we can allocate them?

3. Do we have permissions to write into the hugepage mountpoint?

The existing hugepage check only verifies the first.  On some setups,
a non-root user won't have access to the mountpoint for hugepages to
be allocated and that needs to be reflected in the test as well.  Add
such checks for Linux OS to give a more check when running test suites.
Requirements 2 & 3 are optional.
You don't need a mount point if using the option --in-memory.

[...]
+	perm=""
perm= should do the same.
+	for mount in `mount | grep hugetlbfs | awk '{ print $3; }'`; do
Please prefer $() syntax.
Are spaces in awk required?
+		test ! -w $mount/. || perm="$mount"
Why /. ?
+	done
+	if [ "$perm" = "" -o "$nr_hugepages" = "0" ]; then
= "" can be replaced with -z
"0" can be simply 0
+		echo 0
+	else
+		echo $nr_hugepages
+	fi

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help