Thread (8 messages) 8 messages, 3 authors, 2021-02-05

Re: [dpdk-dev] [v2 PATCH] usertools: show an error message if unable to reserve requested hugepages

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2021-01-07 15:37:43

On Thu, 7 Jan 2021 13:06:35 +0500
Sarosh Arif [off-list ref] wrote:
On Thu, Dec 17, 2020 at 11:19 PM Stephen Hemminger
[off-list ref] wrote:
quoted
On Thu, 17 Dec 2020 16:16:16 +0500
Sarosh Arif [off-list ref] wrote:
 
quoted
+    if get_hugepages(path) != pages:
+        print("Unable to reserve required pages. The pages reserved are:")
+        global SHOW_HUGEPAGES
+        SHOW_HUGEPAGES = True  

Please don't add global's to this script.

The script is close to being clean according to pylint, and globals
are considered bad style and shouldn't be used.

I would just exit if huge pages could not be setup.  
How about if we just print a warning message such as "Unable to
reserve required pages" before exiting, in case the pages are not
reserved due to lack of space in RAM? Then leave it upon the user to
query how many pages are actually reserved.
quoted
The script should leave it up to the user to do another query about
status if they care about what the result is.  
Just call sys.exit with a message that is all that is needed.

Or maybe trapping other write errors to sysfs here. Probably the
kernel has already tried to report the error, but the try/except code
is not seeing it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help