update version to 2.22
This commit is contained in:
parent
67bba4cec8
commit
7a77db784c
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
diff -up libhugetlbfs-2.16/Makefile.orig libhugetlbfs-2.16/Makefile
|
||||
--- libhugetlbfs-2.16/Makefile.orig 2014-03-03 12:50:43.408107252 +0100
|
||||
+++ libhugetlbfs-2.16/Makefile 2014-03-03 12:52:01.070230134 +0100
|
||||
@@ -29,7 +29,7 @@ INSTALL = install
|
||||
|
||||
LDFLAGS += -Wl,-z,noexecstack -ldl
|
||||
CFLAGS ?= -O2 -g
|
||||
-CFLAGS += -Wall -fPIC
|
||||
+CFLAGS += -Wall -fPIC -fstack-protector-strong
|
||||
CPPFLAGS += -D__LIBHUGETLBFS__ -DFORTIFY_SOURCE
|
||||
|
||||
ARCH = $(shell uname -m | sed -e s/i.86/i386/)
|
||||
@ -1,80 +0,0 @@
|
||||
From 26c6b9b99d8f8d7897687a2192be4920a44c1eff Mon Sep 17 00:00:00 2001
|
||||
From: Guillaume Morin <guillaume@morinfr.org>
|
||||
Date: Tue, 1 Nov 2016 22:41:22 +0100
|
||||
Subject: [PATCH 16/28] fix behavior while shrinking
|
||||
|
||||
Adjust mapsize as we're unmapping pages. Do not lie to glibc about
|
||||
shrinking by less than a page. It's unnecessary because we are not
|
||||
giving back any memory to the kernel, but also it forces us to zero
|
||||
out this memory because morecore() assumes by default that "new"
|
||||
memory is already zero'd.
|
||||
|
||||
Signed-off-by: Guillaume Morin <guillaume@morinfr.org>
|
||||
Signed-off-by: Eric B Munson <emunson@mgebm.net>
|
||||
---
|
||||
morecore.c | 37 +++++++++++++++++++++++++++----------
|
||||
1 file changed, 27 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/morecore.c b/morecore.c
|
||||
index 62ad252..6563bbd 100644
|
||||
--- a/morecore.c
|
||||
+++ b/morecore.c
|
||||
@@ -178,20 +178,37 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
|
||||
if (ret) {
|
||||
WARNING("Unmapping failed while shrinking heap: "
|
||||
"%s\n", strerror(errno));
|
||||
- } else if (!__hugetlb_opts.map_hugetlb && !using_default_pagesize){
|
||||
-
|
||||
- /*
|
||||
- * Now shrink the hugetlbfs file.
|
||||
- */
|
||||
+ } else {
|
||||
mapsize += delta;
|
||||
- ret = ftruncate(heap_fd, mapsize);
|
||||
- if (ret) {
|
||||
- WARNING("Could not truncate hugetlbfs file to "
|
||||
- "shrink heap: %s\n", strerror(errno));
|
||||
+ /*
|
||||
+ * the glibc assumes by default that newly allocated
|
||||
+ * memory by morecore() will be zeroed. It would be
|
||||
+ * wasteful to do it for allocation so we only shrink
|
||||
+ * the top by the size of a page.
|
||||
+ */
|
||||
+ increment = heapbase - heaptop + mapsize;
|
||||
+
|
||||
+ if (!__hugetlb_opts.map_hugetlb && !using_default_pagesize){
|
||||
+
|
||||
+ /*
|
||||
+ * Now shrink the hugetlbfs file.
|
||||
+ */
|
||||
+ ret = ftruncate(heap_fd, mapsize);
|
||||
+ if (ret) {
|
||||
+ WARNING("Could not truncate hugetlbfs file to "
|
||||
+ "shrink heap: %s\n", strerror(errno));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+ else if (increment < 0) {
|
||||
+ /* Don't shrink by less than a page to avoid having to zero
|
||||
+ * the memory. There is no point in lying to glibc since
|
||||
+ * we're not freeing any memory.
|
||||
+ */
|
||||
+ increment = 0;
|
||||
+ }
|
||||
|
||||
/* heap is continuous */
|
||||
p = heaptop;
|
||||
@@ -355,7 +372,7 @@ void hugetlbfs_setup_morecore(void)
|
||||
/* Set some allocator options more appropriate for hugepages */
|
||||
|
||||
if (__hugetlb_opts.shrink_ok)
|
||||
- mallopt(M_TRIM_THRESHOLD, hpage_size / 2);
|
||||
+ mallopt(M_TRIM_THRESHOLD, hpage_size + hpage_size / 2);
|
||||
else
|
||||
mallopt(M_TRIM_THRESHOLD, -1);
|
||||
mallopt(M_TOP_PAD, hpage_size / 2);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
From a979e0b01a76f199974c76c9799b0210562147ec Mon Sep 17 00:00:00 2001
|
||||
From: Jan Stancek <jstancek@redhat.com>
|
||||
Date: Thu, 2 Feb 2017 11:04:08 +0100
|
||||
Subject: [PATCH 17/28] ld.hugetlbfs: pick an emulation if -m is not present
|
||||
|
||||
If -m is not passed on command line $EMU ends up empty
|
||||
and as result HPAGE_SIZE and SLICE_SIZE are left uninitialized.
|
||||
|
||||
Try environment variable LDEMULATION and if it's not defined
|
||||
pick first from "Supported emulations" list of ld -V.
|
||||
|
||||
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
||||
Signed-off-by: Eric B Munson <emunson@mgebm.net>
|
||||
---
|
||||
ld.hugetlbfs | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/ld.hugetlbfs b/ld.hugetlbfs
|
||||
index 32bc6fb..2dda451 100755
|
||||
--- a/ld.hugetlbfs
|
||||
+++ b/ld.hugetlbfs
|
||||
@@ -81,6 +81,17 @@ if [ -n "$HTLB_LINK" ]; then
|
||||
HTLBOPTS="-T${HUGETLB_LDSCRIPT_PATH}/${LDSCRIPT}"
|
||||
fi
|
||||
|
||||
+# if -m is not present on command line
|
||||
+if [ -z "$EMU" ]; then
|
||||
+ if [ -n "$LDEMULATION" ]; then
|
||||
+ # try env. variable
|
||||
+ EMU="$LDEMULATION"
|
||||
+ else
|
||||
+ # pick first supported
|
||||
+ EMU="$(ld -V | sed -n '/Supported emulations/{n;p}' | tr -d ' ')"
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
MB=$((1024*1024))
|
||||
case "$EMU" in
|
||||
elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
From ff12744922d0b13ef0373fb00ca057bb4424da23 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Stancek <jstancek@redhat.com>
|
||||
Date: Wed, 15 Feb 2017 14:10:19 +0100
|
||||
Subject: [PATCH 21/28] ld.hugetlbfs: support 512M hugepages on aarch64
|
||||
|
||||
aarch64 supports multiple hugepage sizes, if default is 512M,
|
||||
then all linkhuge_rw tests segfault. This patch detects
|
||||
default huge page size from /proc/meminfo output, rather than
|
||||
using hardcoded value of 2M.
|
||||
|
||||
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
||||
Signed-off-by: Eric B Munson <emunson@mgebm.net>
|
||||
---
|
||||
ld.hugetlbfs | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld.hugetlbfs b/ld.hugetlbfs
|
||||
index 8ee917b..388f7b4 100755
|
||||
--- a/ld.hugetlbfs
|
||||
+++ b/ld.hugetlbfs
|
||||
@@ -109,7 +109,10 @@ elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
|
||||
elf64lppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
|
||||
elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
|
||||
elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
|
||||
-armelf*_linux_eabi|aarch64elf*|aarch64linux*) HPAGE_SIZE=$((2*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
|
||||
+armelf*_linux_eabi|aarch64elf*|aarch64linux*)
|
||||
+ hpage_kb=$(cat /proc/meminfo | grep Hugepagesize: | awk '{print $2}')
|
||||
+ HPAGE_SIZE=$((hpage_kb * 1024))
|
||||
+ SLICE_SIZE=$HPAGE_SIZE ;;
|
||||
esac
|
||||
|
||||
if [ "$HTLB_ALIGN" == "slice" ]; then
|
||||
@@ -119,7 +122,7 @@ if [ "$HTLB_ALIGN" == "slice" ]; then
|
||||
# targeting the ARM platform one needs to explicitly set the text segment offset
|
||||
# otherwise it will be NULL.
|
||||
case "$EMU" in
|
||||
- armelf*_linux_eabi) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;;
|
||||
+ armelf*_linux_eabi|aarch64elf*|aarch64linux*) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
From e1c5a625a5d82aed84fdd5db0643fb865d21b5bf Mon Sep 17 00:00:00 2001
|
||||
From: lihongjiang <lihongjiang6@huawei.com>
|
||||
Date: Mon, 22 Apr 2019 22:11:55 +0800
|
||||
Subject: [PATCH] libhugetlbfs: fix tests with heapshrink fail
|
||||
|
||||
reason:fix tests with heapshrink fail
|
||||
|
||||
Signed-off-by: lihongjiang <lihongjiang6@huawei.com>
|
||||
---
|
||||
tests/heapshrink.c | 12 +++++++++---
|
||||
tests/run_tests.py | 2 +-
|
||||
2 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/heapshrink.c b/tests/heapshrink.c
|
||||
index 0644c78..bd2e62b 100644
|
||||
--- a/tests/heapshrink.c
|
||||
+++ b/tests/heapshrink.c
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
- int is_huge, have_env, shrink_ok, have_helper;
|
||||
+ int is_huge, have_env, shrink_ok, have_helper, tcache_enabled;
|
||||
unsigned long long mapping_size;
|
||||
void *p;
|
||||
|
||||
@@ -45,6 +45,8 @@ int main(int argc, char **argv)
|
||||
p = getenv("LD_PRELOAD");
|
||||
have_helper = p != NULL && strstr(p, "heapshrink") != NULL;
|
||||
|
||||
+ p=getenv("GLIBC_TUNABLES");
|
||||
+ tcache_enabled = p != NULL && strstr(p, "malloc.tcache_count=0");
|
||||
p = malloc(SIZE);
|
||||
if (!p) {
|
||||
if (shrink_ok && have_helper) {
|
||||
@@ -68,7 +70,11 @@ int main(int argc, char **argv)
|
||||
|
||||
free(p);
|
||||
mapping_size = get_mapping_page_size(p+SIZE-1);
|
||||
- if (shrink_ok && mapping_size > MIN_PAGE_SIZE)
|
||||
- FAIL("Heap did not shrink");
|
||||
+ if (shrink_ok && mapping_size > MIN_PAGE_SIZE) {
|
||||
+ if (tcache_enabled)
|
||||
+ FAIL("Heap did not shrink");
|
||||
+ else
|
||||
+ FAIL("Heap didn't shrink. Check malloc.tcache_count=0");
|
||||
+ }
|
||||
PASS();
|
||||
}
|
||||
diff --git a/tests/run_tests.py b/tests/run_tests.py
|
||||
index 22e74c8..8cc6d43 100755
|
||||
--- a/tests/run_tests.py
|
||||
+++ b/tests/run_tests.py
|
||||
@@ -575,7 +575,7 @@ def functional_tests():
|
||||
HUGETLB_MORECORE="yes")
|
||||
do_test("heapshrink", LD_PRELOAD="libheapshrink.so", HUGETLB_MORECORE="yes",
|
||||
HUGETLB_MORECORE_SHRINK="yes")
|
||||
- do_test("heapshrink", LD_PRELOAD="libhugetlbfs.so libheapshrink.so",
|
||||
+ do_test("heapshrink", GLIBC_TUNABLES="glibc.malloc.tcache_count=0", LD_PRELOAD="libhugetlbfs.so libheapshrink.so",
|
||||
HUGETLB_MORECORE="yes", HUGETLB_MORECORE_SHRINK="yes")
|
||||
do_test("heap-overflow", HUGETLB_VERBOSE="1", HUGETLB_MORECORE="yes")
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,306 +0,0 @@
|
||||
From ea54bafb9552a561f7dc746f5dec33cca62419f7 Mon Sep 17 00:00:00 2001
|
||||
From: lihongjiang <lihongjiang6@huawei.com>
|
||||
Date: Tue, 25 Feb 2020 10:51:17 +0800
|
||||
Subject: [PATCH] change script from py2 to py3
|
||||
|
||||
diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py
|
||||
index 43c9916..a9ba2bf 100755
|
||||
--- a/huge_page_setup_helper.py
|
||||
+++ b/huge_page_setup_helper.py
|
||||
@@ -14,13 +14,13 @@ debug = False
|
||||
|
||||
# must be executed under the root to operate
|
||||
if os.geteuid() != 0:
|
||||
- print "You must be root to setup hugepages!"
|
||||
+ print("You must be root to setup hugepages!")
|
||||
os._exit(1)
|
||||
|
||||
# config files we need access to
|
||||
sysctlConf = "/etc/sysctl.conf"
|
||||
if not os.access(sysctlConf, os.W_OK):
|
||||
- print "Cannot access %s" % sysctlConf
|
||||
+ print("Cannot access %s" % sysctlConf)
|
||||
if debug == False:
|
||||
os._exit(1)
|
||||
|
||||
@@ -41,7 +41,7 @@ for line in hugeadmexplain:
|
||||
break
|
||||
|
||||
if memTotal == 0:
|
||||
- print "Your version of libhugetlbfs' hugeadm utility is too old!"
|
||||
+ print("Your version of libhugetlbfs' hugeadm utility is too old!")
|
||||
os._exit(1)
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ for line in poolList:
|
||||
break
|
||||
|
||||
if hugePageSize == 0:
|
||||
- print "Aborting, cannot determine system huge page size!"
|
||||
+ print("Aborting, cannot determine system huge page size!")
|
||||
os._exit(1)
|
||||
|
||||
# Get initial sysctl settings
|
||||
@@ -83,22 +83,22 @@ for line in groupNames:
|
||||
|
||||
|
||||
# dump system config as we see it before we start tweaking it
|
||||
-print "Current configuration:"
|
||||
-print " * Total System Memory......: %6d MB" % memTotal
|
||||
-print " * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024))
|
||||
-print " * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024))
|
||||
-print " * Number of Huge Pages.....: %6d" % hugePages
|
||||
-print " * Total size of Huge Pages.: %6d MB" % (hugePages * hugePageSize / (1024 * 1024))
|
||||
-print " * Remaining System Memory..: %6d MB" % (memTotal - (hugePages * hugePageSize / (1024 * 1024)))
|
||||
-print " * Huge Page User Group.....: %s (%d)" % (hugeGIDName, hugeGID)
|
||||
-print
|
||||
+print("Current configuration:")
|
||||
+print(" * Total System Memory......: %6d MB" % memTotal)
|
||||
+print(" * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024)))
|
||||
+print(" * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024)))
|
||||
+print(" * Number of Huge Pages.....: %6d" % hugePages)
|
||||
+print(" * Total size of Huge Pages.: %6d MB" % (hugePages * hugePageSize / (1024 * 1024)))
|
||||
+print(" * Remaining System Memory..: %6d MB" % (memTotal - (hugePages * hugePageSize / (1024 * 1024))))
|
||||
+print(" * Huge Page User Group.....: %s (%d)" % (hugeGIDName, hugeGID))
|
||||
+print()
|
||||
|
||||
|
||||
# ask how memory they want to allocate for huge pages
|
||||
userIn = None
|
||||
while not userIn:
|
||||
try:
|
||||
- userIn = raw_input("How much memory would you like to allocate for huge pages? "
|
||||
+ userIn = input("How much memory would you like to allocate for huge pages? "
|
||||
"(input in MB, unless postfixed with GB): ")
|
||||
if userIn[-2:] == "GB":
|
||||
userHugePageReqMB = int(userIn[0:-2]) * 1024
|
||||
@@ -113,19 +113,19 @@ while not userIn:
|
||||
# As a sanity safeguard, require at least 128M not be allocated to huge pages
|
||||
if userHugePageReqMB > (memTotal - 128):
|
||||
userIn = None
|
||||
- print "Refusing to allocate %d, you must leave at least 128MB for the system" % userHugePageReqMB
|
||||
+ print("Refusing to allocate %d, you must leave at least 128MB for the system" % userHugePageReqMB)
|
||||
elif userHugePageReqMB < (hugePageSize / (1024 * 1024)):
|
||||
userIn = None
|
||||
- print "Sorry, allocation must be at least a page's worth!"
|
||||
+ print("Sorry, allocation must be at least a page's worth!")
|
||||
else:
|
||||
break
|
||||
except ValueError:
|
||||
userIn = None
|
||||
- print "Input must be an integer, please try again!"
|
||||
+ print("Input must be an integer, please try again!")
|
||||
userHugePageReqKB = userHugePageReqMB * 1024
|
||||
userHugePagesReq = userHugePageReqKB / (hugePageSize / 1024)
|
||||
-print "Okay, we'll try to allocate %d MB for huge pages..." % userHugePageReqMB
|
||||
-print
|
||||
+print("Okay, we'll try to allocate %d MB for huge pages..." % userHugePageReqMB)
|
||||
+print()
|
||||
|
||||
|
||||
# some basic user input validation
|
||||
@@ -134,24 +134,24 @@ inputIsValid = False
|
||||
# ask for the name of the group allowed access to huge pages
|
||||
while inputIsValid == False:
|
||||
foundbad = False
|
||||
- userGroupReq = raw_input("What group should have access to the huge pages?"
|
||||
+ userGroupReq = input("What group should have access to the huge pages?"
|
||||
"(The group will be created, if need be) [hugepages]: ")
|
||||
if userGroupReq is '':
|
||||
userGroupReq = 'hugepages'
|
||||
if userGroupReq[0].isdigit() or userGroupReq[0] == "-":
|
||||
foundbad = True
|
||||
- print "Group names cannot start with a number or dash, please try again!"
|
||||
+ print("Group names cannot start with a number or dash, please try again!")
|
||||
for char in badchars:
|
||||
if char in userGroupReq:
|
||||
foundbad = True
|
||||
- print "Illegal characters in group name, please try again!"
|
||||
+ print("Illegal characters in group name, please try again!")
|
||||
break
|
||||
if len(userGroupReq) > 16:
|
||||
foundbad = True
|
||||
- print "Group names can't be more than 16 characaters, please try again!"
|
||||
+ print("Group names can't be more than 16 characaters, please try again!")
|
||||
if foundbad == False:
|
||||
inputIsValid = True
|
||||
-print "Okay, we'll give group %s access to the huge pages" % userGroupReq
|
||||
+print("Okay, we'll give group %s access to the huge pages" % userGroupReq)
|
||||
|
||||
|
||||
# see if group already exists, use it if it does, if not, create it
|
||||
@@ -163,20 +163,20 @@ for line in groupNames:
|
||||
break
|
||||
|
||||
if userGIDReq > -1:
|
||||
- print "Group %s (gid %d) already exists, we'll use it" % (userGroupReq, userGIDReq)
|
||||
+ print("Group %s (gid %d) already exists, we'll use it" % (userGroupReq, userGIDReq))
|
||||
else:
|
||||
if debug == False:
|
||||
os.popen("/usr/sbin/groupadd %s" % userGroupReq)
|
||||
else:
|
||||
- print "/usr/sbin/groupadd %s" % userGroupReq
|
||||
+ print("/usr/sbin/groupadd %s" % userGroupReq)
|
||||
groupNames = os.popen("/usr/bin/getent group %s" % userGroupReq).readlines()
|
||||
for line in groupNames:
|
||||
curGroupName = line.split(":")[0]
|
||||
if curGroupName == userGroupReq:
|
||||
userGIDReq = int(line.split(":")[2])
|
||||
break
|
||||
- print "Created group %s (gid %d) for huge page use" % (userGroupReq, userGIDReq)
|
||||
-print
|
||||
+ print("Created group %s (gid %d) for huge page use" % (userGroupReq, userGIDReq))
|
||||
+print()
|
||||
|
||||
|
||||
# basic user input validation, take 2
|
||||
@@ -186,20 +186,20 @@ inputIsValid = False
|
||||
# ask for user(s) that should be in the huge page access group
|
||||
while inputIsValid == False:
|
||||
foundbad = False
|
||||
- userUsersReq = raw_input("What user(s) should have access to the huge pages (space-delimited list, users created as needed)? ")
|
||||
+ userUsersReq = input("What user(s) should have access to the huge pages (space-delimited list, users created as needed)? ")
|
||||
for char in badchars:
|
||||
if char in userUsersReq:
|
||||
foundbad = True
|
||||
- print "Illegal characters in user name(s) or invalid list format, please try again!"
|
||||
+ print("Illegal characters in user name(s) or invalid list format, please try again!")
|
||||
break
|
||||
for n in userUsersReq.split():
|
||||
if len(n) > 32:
|
||||
foundbad = True
|
||||
- print "User names can't be more than 32 characaters, please try again!"
|
||||
+ print("User names can't be more than 32 characaters, please try again!")
|
||||
break
|
||||
if n[0] == "-":
|
||||
foundbad = True
|
||||
- print "User names cannot start with a dash, please try again!"
|
||||
+ print("User names cannot start with a dash, please try again!")
|
||||
break
|
||||
if foundbad == False:
|
||||
inputIsValid = True
|
||||
@@ -211,24 +211,24 @@ for hugeUser in hugePageUserList:
|
||||
for line in curUserList:
|
||||
curUser = line.split(":")[0]
|
||||
if curUser == hugeUser:
|
||||
- print "Adding user %s to huge page group" % hugeUser
|
||||
+ print("Adding user %s to huge page group" % hugeUser)
|
||||
userExists = True
|
||||
if debug == False:
|
||||
os.popen("/usr/sbin/usermod -a -G %s %s" % (userGroupReq, hugeUser))
|
||||
else:
|
||||
- print "/usr/sbin/usermod -a -G %s %s" % (userGroupReq, hugeUser)
|
||||
+ print("/usr/sbin/usermod -a -G %s %s" % (userGroupReq, hugeUser))
|
||||
if userExists == True:
|
||||
break
|
||||
if userExists == False:
|
||||
- print "Creating user %s with membership in huge page group" % hugeUser
|
||||
+ print("Creating user %s with membership in huge page group" % hugeUser)
|
||||
if debug == False:
|
||||
if hugeUser == userGroupReq:
|
||||
os.popen("/usr/sbin/useradd %s -g %s" % (hugeUser, userGroupReq))
|
||||
else:
|
||||
os.popen("/usr/sbin/useradd %s -G %s" % (hugeUser, userGroupReq))
|
||||
else:
|
||||
- print "/usr/sbin/useradd %s -G %s" % (hugeUser, userGroupReq)
|
||||
-print
|
||||
+ print("/usr/sbin/useradd %s -G %s" % (hugeUser, userGroupReq))
|
||||
+print()
|
||||
|
||||
|
||||
# set values for the current running environment
|
||||
@@ -238,11 +238,11 @@ if debug == False:
|
||||
os.popen("/usr/bin/hugeadm --set-shm-group %d" % userGIDReq)
|
||||
os.popen("/usr/bin/hugeadm --set-recommended-shmmax")
|
||||
else:
|
||||
- print "/usr/bin/hugeadm --pool-pages-min DEFAULT:%sM" % userHugePageReqMB
|
||||
- print "/usr/bin/hugeadm --pool-pages-max DEFAULT:%sM" % userHugePageReqMB
|
||||
- print "/usr/bin/hugeadm --set-shm-group %d" % userGIDReq
|
||||
- print "/usr/bin/hugeadm --set-recommended-shmmax"
|
||||
- print
|
||||
+ print("/usr/bin/hugeadm --pool-pages-min DEFAULT:%sM" % userHugePageReqMB)
|
||||
+ print("/usr/bin/hugeadm --pool-pages-max DEFAULT:%sM" % userHugePageReqMB)
|
||||
+ print("/usr/bin/hugeadm --set-shm-group %d" % userGIDReq)
|
||||
+ print("/usr/bin/hugeadm --set-recommended-shmmax")
|
||||
+ print()
|
||||
|
||||
# figure out what that shmmax value we just set was
|
||||
hugeadmexplain = os.popen("/usr/bin/hugeadm --explain 2>/dev/null").readlines()
|
||||
@@ -258,7 +258,7 @@ if debug == False:
|
||||
try:
|
||||
sysctlConfLines = open(sysctlConf).readlines()
|
||||
os.rename(sysctlConf, sysctlConf + ".backup")
|
||||
- print("Saved original %s as %s.backup" % (sysctlConf, sysctlConf))
|
||||
+ print(("Saved original %s as %s.backup" % (sysctlConf, sysctlConf)))
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -279,11 +279,11 @@ if debug == False:
|
||||
fd.close()
|
||||
|
||||
else:
|
||||
- print "Add to %s:" % sysctlConf
|
||||
- print "kernel.shmmax = %d" % shmmax
|
||||
- print "vm.nr_hugepages = %d" % userHugePagesReq
|
||||
- print "vm.hugetlb_shm_group = %d" % userGIDReq
|
||||
- print
|
||||
+ print("Add to %s:" % sysctlConf)
|
||||
+ print("kernel.shmmax = %d" % shmmax)
|
||||
+ print("vm.nr_hugepages = %d" % userHugePagesReq)
|
||||
+ print("vm.hugetlb_shm_group = %d" % userGIDReq)
|
||||
+ print()
|
||||
|
||||
|
||||
# write out limits.conf changes to persist across reboot
|
||||
@@ -293,7 +293,7 @@ if debug == False:
|
||||
try:
|
||||
limitsConfLines = open(limitsConf).readlines()
|
||||
os.rename(limitsConf, limitsConf + ".backup")
|
||||
- print("Saved original %s as %s.backup" % (limitsConf, limitsConf))
|
||||
+ print(("Saved original %s as %s.backup" % (limitsConf, limitsConf)))
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -319,25 +319,25 @@ if debug == False:
|
||||
fd.close()
|
||||
|
||||
else:
|
||||
- print "Add to %s:" % limitsConf
|
||||
+ print("Add to %s:" % limitsConf)
|
||||
for hugeUser in hugePageUserList:
|
||||
- print "%s soft memlock %d" % (hugeUser, userHugePageReqKB)
|
||||
- print "%s hard memlock %d" % (hugeUser, userHugePageReqKB)
|
||||
+ print("%s soft memlock %d" % (hugeUser, userHugePageReqKB))
|
||||
+ print("%s hard memlock %d" % (hugeUser, userHugePageReqKB))
|
||||
|
||||
|
||||
# dump the final configuration of things now that we're done tweaking
|
||||
-print
|
||||
-print "Final configuration:"
|
||||
-print " * Total System Memory......: %6d MB" % memTotal
|
||||
+print()
|
||||
+print("Final configuration:")
|
||||
+print(" * Total System Memory......: %6d MB" % memTotal)
|
||||
if debug == False:
|
||||
- print " * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024))
|
||||
+ print(" * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024)))
|
||||
else:
|
||||
# This should be what we *would* have set it to, had we actually run hugeadm --set-recommended-shmmax
|
||||
- print " * Shared Mem Max Mapping...: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024))
|
||||
-print " * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024))
|
||||
-print " * Available Huge Pages.....: %6d" % userHugePagesReq
|
||||
-print " * Total size of Huge Pages.: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024))
|
||||
-print " * Remaining System Memory..: %6d MB" % (memTotal - userHugePageReqMB)
|
||||
-print " * Huge Page User Group.....: %s (%d)" % (userGroupReq, userGIDReq)
|
||||
-print
|
||||
+ print(" * Shared Mem Max Mapping...: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024)))
|
||||
+print(" * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024)))
|
||||
+print(" * Available Huge Pages.....: %6d" % userHugePagesReq)
|
||||
+print(" * Total size of Huge Pages.: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024)))
|
||||
+print(" * Remaining System Memory..: %6d MB" % (memTotal - userHugePageReqMB))
|
||||
+print(" * Huge Page User Group.....: %s (%d)" % (userGroupReq, userGIDReq))
|
||||
+print()
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
Binary file not shown.
BIN
libhugetlbfs-2.22.tar.gz
Normal file
BIN
libhugetlbfs-2.22.tar.gz
Normal file
Binary file not shown.
@ -2,12 +2,14 @@ diff --git a/Makefile b/Makefile
|
||||
index 73ebad7..3735440 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -30,7 +30,7 @@ INSTALL = install
|
||||
LDFLAGS += -Wl,-z,noexecstack -ldl
|
||||
@@ -30,8 +30,8 @@ INSTALL = install
|
||||
|
||||
LDFLAGS += -ldl
|
||||
CFLAGS ?= -O2 -g
|
||||
CFLAGS += -Wall -fPIC
|
||||
-CFLAGS += -Wall -fPIC
|
||||
-CPPFLAGS += -D__LIBHUGETLBFS__
|
||||
+CFLAGS += -Wall -fPIC -fstack-protector-strong
|
||||
+CPPFLAGS += -D__LIBHUGETLBFS__ -DFORTIFY_SOURCE
|
||||
|
||||
ARCH = $(shell uname -m | sed -e s/i.86/i386/)
|
||||
|
||||
ARCH ?= $(shell uname -m | sed -e s/i.86/i386/)
|
||||
CC ?= gcc
|
||||
@ -1,24 +1,18 @@
|
||||
%global ldscriptdir %{_datadir}/%{name}/ldscripts
|
||||
|
||||
Name: libhugetlbfs
|
||||
Version: 2.20
|
||||
Release: 14
|
||||
Version: 2.22
|
||||
Release: 1
|
||||
Summary: A library which provides easy access to huge pages of memory
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/libhugetlbfs/libhugetlbfs
|
||||
Source0: https://github.com/libhugetlbfs/libhugetlbfs/releases/download/%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0000: 0000-build_flags.patch
|
||||
Patch0001: 0001-libhugetlbfs-2.15-fortify.patch
|
||||
Patch0002: 0002-libhugetlbfs-2.16-makefile_cflags.patch
|
||||
Patch0003: 0003-fix-behavior-while-shrinking.patch
|
||||
Patch0004: 0004-ld.hugetlbfs-pick-an-emulation-if-m-is-not-present.patch
|
||||
Patch0005: 0005-ld.hugetlbfs-support-512M-hugepages-on-aarch64.patch
|
||||
Patch0006: 0006-libhugetlbfs-fix-tests-with-heapshrink-fail.patch
|
||||
Patch0007: 0007-libhugetlbfs-2.20-change-scripts-to-py3.patch
|
||||
|
||||
Patch9000:libhugetlbfs-2.16-remap_segments_with_MAP_SHARED.patch
|
||||
Patch9001:libhugetlbfs-2.16-remap_segments_with_MAP_SHARED-2.patch
|
||||
Patch9002:libhugetlbfs-make-cflags.patch
|
||||
|
||||
BuildRequires: gcc glibc-devel glibc-static
|
||||
|
||||
@ -90,6 +84,12 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/security/limits.d/hugepages.conf
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Apr 24 2020 lihongjiang<lihongjiang6@huawei.com> - 2.22-1
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:restart
|
||||
- DESC:update version to 2.22
|
||||
|
||||
* Tue Feb 25 2020 lihongjiang<lihongjiang6@huawei.com> - 2.20-14
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user