[v3] usertools: show an error message if unable to reserve requested hugepages

Message ID 20210108090627.17365-1-sarosh.arif@emumba.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] usertools: show an error message if unable to reserve requested hugepages |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Sarosh Arif Jan. 8, 2021, 9:06 a.m. UTC
  Sometimes the system is unable to reserve the requested hugepages because
enough space is not available in the RAM. In that case, currently the
script displays no error message hence the user can be under the delusion
that the hugepages requested are all successfully reserved. This patch
displays an error message if the pages reserved are different from the
requested pages.


Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
---
v2:
use a global variable SHOW_HUGEPAGES to remove linter warnings
v3:
only print an error message if unable to reserve hugepages.
---
 usertools/dpdk-hugepages.py | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Thomas Monjalon Feb. 5, 2021, 6:24 p.m. UTC | #1
08/01/2021 10:06, Sarosh Arif:
> Sometimes the system is unable to reserve the requested hugepages because
> enough space is not available in the RAM. In that case, currently the
> script displays no error message hence the user can be under the delusion
> that the hugepages requested are all successfully reserved. This patch
> displays an error message if the pages reserved are different from the
> requested pages.
> 
> Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
> ---
> v2:
> use a global variable SHOW_HUGEPAGES to remove linter warnings
> v3:
> only print an error message if unable to reserve hugepages.
> ---
> +    if get_hugepages(path) != pages:
> +        sys.exit("Unable to reserve required pages.")

Replaced double quotes by simple ones.

Applied, thanks.
  

Patch

diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py
index 1be100ca3..1523be20a 100755
--- a/usertools/dpdk-hugepages.py
+++ b/usertools/dpdk-hugepages.py
@@ -62,6 +62,8 @@  def set_hugepages(path, pages):
         filename = os.path.basename(path)
         size = filename[10:]
         sys.exit('{} is not a valid system huge page size'.format(size))
+    if get_hugepages(path) != pages:
+        sys.exit("Unable to reserve required pages.")
 
 
 def show_numa_pages():