Blame SOURCES/libhugetlbfs-2.20-do-not-assume-default-huge-page-size-is-first.patch

f4a552
commit 77cf8bdf8f523c1417e5dc54db72fb74c8c15f56
f4a552
Author: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
f4a552
Date:   Tue Sep 1 12:26:59 2015 -0700
f4a552
f4a552
    huge_page_setup_helper: do not assume default huge page size is first
f4a552
    
f4a552
    The helper script currently implicitly assumes that `hugeadm
f4a552
    --pool-list` will emit the default size first, as it assumes every line
f4a552
    has 5 fields in it. But only the default field does, and if `hugeadm
f4a552
    --pool-list` were to output:
f4a552
    
f4a552
    hugeadm --pool-list
f4a552
          Size  Minimum  Current  Maximum  Default
f4a552
       1048576        0        0        0
f4a552
      16777216        0        0        0        *
f4a552
    17179869184        0        0        0
f4a552
    
f4a552
    we receive an error from the script:
f4a552
     # ./huge_page_setup_helper.py
f4a552
    Traceback (most recent call last):
f4a552
      File "./huge_page_setup_helper.py", line 51, in <module>
f4a552
        if line.split()[4] == '*':
f4a552
    IndexError: list index out of range
f4a552
    
f4a552
    Just check for the '*' character to determine the default line.
f4a552
    
f4a552
    Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
f4a552
    Signed-off-by: Eric B Munson <emunson@mgebm.net>
f4a552
f4a552
diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py
f4a552
index 8bfef14..43c9916 100755
f4a552
--- a/huge_page_setup_helper.py
f4a552
+++ b/huge_page_setup_helper.py
f4a552
@@ -48,7 +48,7 @@ if memTotal == 0:
f4a552
 # Pick the default huge page size and see how many pages are allocated
f4a552
 poolList = os.popen("/usr/bin/hugeadm --pool-list").readlines()
f4a552
 for line in poolList:
f4a552
-    if line.split()[4] == '*':
f4a552
+    if '*' in line:
f4a552
         hugePageSize = int(line.split()[0])
f4a552
         hugePages = int(line.split()[2])
f4a552
         break