Update upstream fixes for memkind-0.3.0
- Switch old init.d scripts for systemd unit service - Fix fc24 build error Signed-off-by: Rafael Aquini <aquini@linux.com>
This commit is contained in:
parent
ebd372f6f4
commit
521f6dc363
138
0001-Treshold-calculation-fixed.patch
Normal file
138
0001-Treshold-calculation-fixed.patch
Normal file
@ -0,0 +1,138 @@
|
||||
From 6aacbbcbb67cbc45eee780eb9765bd066e299f19 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6aacbbcbb67cbc45eee780eb9765bd066e299f19.1454769807.git.aquini@redhat.com>
|
||||
From: Grzegorz Ozanski <grzegorz.ozanski@intel.com>
|
||||
Date: Sat, 26 Sep 2015 18:47:35 +0200
|
||||
Subject: [PATCH 1/3] Treshold calculation fixed. Use #pragma once instead of
|
||||
#ifdef #define #endif Added TC_Memkind_ prefix to
|
||||
many_ops_many_iters_many_kinds test Metrics display reformatted. Show
|
||||
negative calculated delta if results are actually better than reference
|
||||
Increase threads to 144
|
||||
|
||||
---
|
||||
test/performance/framework.hpp | 3 ++-
|
||||
test/performance/operations.hpp | 4 +++-
|
||||
test/performance/perf_tests.cpp | 14 ++++++++------
|
||||
test/performance/perf_tests.hpp | 7 ++-----
|
||||
4 files changed, 15 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/test/performance/framework.hpp b/test/performance/framework.hpp
|
||||
index f306ea0..109c6e6 100644
|
||||
--- a/test/performance/framework.hpp
|
||||
+++ b/test/performance/framework.hpp
|
||||
@@ -22,6 +22,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
+#pragma once
|
||||
+
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <algorithm> // log2
|
||||
@@ -33,7 +35,6 @@
|
||||
// Malloc, jemalloc, memkind jemalloc and memkind memory operations definitions
|
||||
#include "operations.hpp"
|
||||
|
||||
-#pragma once
|
||||
/* Framework for testing memory allocators pefromance */
|
||||
namespace performance_tests
|
||||
{
|
||||
diff --git a/test/performance/operations.hpp b/test/performance/operations.hpp
|
||||
index 8a3c321..dc70b73 100644
|
||||
--- a/test/performance/operations.hpp
|
||||
+++ b/test/performance/operations.hpp
|
||||
@@ -21,12 +21,14 @@
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
#include <malloc.h>
|
||||
#include <memkind.h>
|
||||
#include "jemalloc/jemalloc.h"
|
||||
|
||||
// Malloc, jemalloc, memkind jemalloc and memkind memory operations definitions
|
||||
-#pragma once
|
||||
namespace performance_tests
|
||||
{
|
||||
using std::vector;
|
||||
diff --git a/test/performance/perf_tests.cpp b/test/performance/perf_tests.cpp
|
||||
index cf07177..10fe80b 100644
|
||||
--- a/test/performance/perf_tests.cpp
|
||||
+++ b/test/performance/perf_tests.cpp
|
||||
@@ -24,11 +24,13 @@
|
||||
|
||||
#include "perf_tests.hpp"
|
||||
#include <iostream>
|
||||
+#include <cmath>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// Memkind performance tests
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
+using std::abs;
|
||||
|
||||
// Memkind tests
|
||||
class PerformanceTest : public testing::Test
|
||||
@@ -55,15 +57,15 @@ protected:
|
||||
double treshold;
|
||||
if (notLessThan)
|
||||
{
|
||||
- treshold = reference / (1 + Delta);
|
||||
+ treshold = reference * (1 - delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
- treshold = reference * (1 + Delta);
|
||||
+ treshold = reference * (1 + delta);
|
||||
}
|
||||
- cout << "Value of '" << info << "' expected to be at " << (notLessThan ? "least '" : "most '")
|
||||
- << treshold << "'. Actual='" << value << "', reference='"
|
||||
- << reference << "', delta='" << delta << "'." << endl;
|
||||
+ cout << "Metric: " << info << ". Reference value: " << reference << ". "
|
||||
+ "Expected: " << (notLessThan ? ">= " : "<= ") << treshold << " (delta = " << delta << ")."
|
||||
+ "Actual: " << value << " (delta = " << (value - reference) * (notLessThan ? -1.0 : 1.0) / reference << ")." << endl;
|
||||
if (notLessThan ? (value >= treshold) : (value <= treshold))
|
||||
{
|
||||
return true;
|
||||
@@ -136,7 +138,7 @@ PERF_TEST(PerformanceTest, many_ops_many_iters)
|
||||
EXPECT_TRUE(compareMetrics(performanceMetrics, referenceMetrics, Delta));
|
||||
}
|
||||
|
||||
-TEST_F(PerformanceTest, many_ops_many_iters_many_kinds)
|
||||
+PERF_TEST(PerformanceTest, many_ops_many_iters_many_kinds)
|
||||
{
|
||||
referenceTest.setupTest_manyOpsManyIters();
|
||||
referenceMetrics = referenceTest.runTest({ MEMKIND_DEFAULT, MEMKIND_HBW_PREFERRED });
|
||||
diff --git a/test/performance/perf_tests.hpp b/test/performance/perf_tests.hpp
|
||||
index 4e16b7e..30b196f 100644
|
||||
--- a/test/performance/perf_tests.hpp
|
||||
+++ b/test/performance/perf_tests.hpp
|
||||
@@ -22,8 +22,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
-#ifndef __PERF_TESTS_HPP
|
||||
-#define __PERF_TESTS_HPP
|
||||
+#pragma once
|
||||
|
||||
#include "framework.hpp"
|
||||
#include "operations.hpp"
|
||||
@@ -50,7 +49,7 @@ private:
|
||||
performance_tests::PerformanceTest *m_test;
|
||||
const unsigned m_seed = 1297654;
|
||||
const unsigned m_repeats = 5;
|
||||
- const unsigned m_threads = 72;
|
||||
+ const unsigned m_threads = 144;
|
||||
const unsigned m_iterations = 100;
|
||||
|
||||
public:
|
||||
@@ -188,5 +187,3 @@ public:
|
||||
m_test->setExecutionMode(ExecutionMode::ManyIterations);
|
||||
}
|
||||
};
|
||||
-
|
||||
-#endif // __PERF_TESTS_HPP
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 74f8dd6193fe1ae1e475452a76f9c4daaf602a63 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <74f8dd6193fe1ae1e475452a76f9c4daaf602a63.1431444153.git.aquini@redhat.com>
|
||||
From: Rafael Aquini <aquini@redhat.com>
|
||||
Date: Tue, 12 May 2015 11:22:30 -0400
|
||||
Subject: [PATCH] memkind-pmtt: stop nuking sysconfdir and contents
|
||||
|
||||
memkind-pmtt tool should not be nuking the sysconfdir -- /etc/memkind --
|
||||
in order to not overlap content ownership with package managers such RPM
|
||||
as well as to avoid crazy havocs of racy file and dir unlinks with concurrent
|
||||
usage from the libs or other parses via parallel memkind-pmtt invocations.
|
||||
|
||||
This patch removes the sysconfdir nuking points for the memkind-pmtt tool and
|
||||
its sysv init script as well as it delegates the 'MEMKIND_FILE' file deletion
|
||||
control only to the sysv init script for procedural consistency.
|
||||
|
||||
Signed-off-by: Rafael Aquini <aquini@redhat.com>
|
||||
---
|
||||
init.d/memkind | 8 --------
|
||||
src/memkind_pmtt.c | 7 -------
|
||||
2 files changed, 15 deletions(-)
|
||||
|
||||
diff --git a/init.d/memkind b/init.d/memkind
|
||||
index 1be0954..2ba6745 100755
|
||||
--- a/init.d/memkind
|
||||
+++ b/init.d/memkind
|
||||
@@ -90,14 +90,6 @@ stop() {
|
||||
if [ $err -eq 0 ] && [ ! -f $MEMKIND_FILE ]
|
||||
then
|
||||
echo_success "deleted file: $MEMKIND_FILE"
|
||||
- rmdir $MEMKIND_DIR
|
||||
- err=$?
|
||||
- if [ $err -eq 0 ] && [ ! -d $MEMKIND_DIR ]
|
||||
- then
|
||||
- echo_success "deleted directory: $MEMKIND_DIR"
|
||||
- else
|
||||
- echo_failure "could not delete directory: $MEMKIND_DIR"
|
||||
- fi
|
||||
else
|
||||
echo_failure "could not delete file: $MEMKIND_FILE"
|
||||
fi
|
||||
diff --git a/src/memkind_pmtt.c b/src/memkind_pmtt.c
|
||||
index ebabafd..9d9296c 100644
|
||||
--- a/src/memkind_pmtt.c
|
||||
+++ b/src/memkind_pmtt.c
|
||||
@@ -220,7 +220,6 @@ int memkind_pmtt(char *pmtt_path, char *bandwidth_path)
|
||||
err = errno ? -errno : 1;
|
||||
goto exit;
|
||||
}
|
||||
- unlink(bandwidth_path);
|
||||
fd = open(bandwidth_path, O_CREAT | O_EXCL | O_WRONLY, 0644);
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "ERROR: <memkind_pmtt> opening %s for writing\n", bandwidth_path);
|
||||
@@ -252,12 +251,6 @@ exit:
|
||||
if (bandwidth != NULL) {
|
||||
free(bandwidth);
|
||||
}
|
||||
- if (err) {
|
||||
- unlink(bandwidth_path);
|
||||
- if(*dir) {
|
||||
- rmdir(dir);
|
||||
- }
|
||||
- }
|
||||
return err;
|
||||
}
|
||||
|
||||
--
|
||||
2.1.0
|
||||
|
70
0002-Execute-tests-from-package-installation-directory.patch
Normal file
70
0002-Execute-tests-from-package-installation-directory.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From ee2f8088586b0e26f2f837a5126b93039255b6e4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ee2f8088586b0e26f2f837a5126b93039255b6e4.1454769807.git.aquini@redhat.com>
|
||||
In-Reply-To: <6aacbbcbb67cbc45eee780eb9765bd066e299f19.1454769807.git.aquini@redhat.com>
|
||||
References: <6aacbbcbb67cbc45eee780eb9765bd066e299f19.1454769807.git.aquini@redhat.com>
|
||||
From: Grzegorz Ozanski <grzegorz.ozanski@intel.com>
|
||||
Date: Fri, 25 Sep 2015 09:50:10 -0400
|
||||
Subject: [PATCH 2/3] Execute tests from package installation directory
|
||||
|
||||
---
|
||||
test/memkind_ft.py | 23 +++++++----------------
|
||||
1 file changed, 7 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/test/memkind_ft.py b/test/memkind_ft.py
|
||||
index d75e270..94ac695 100644
|
||||
--- a/test/memkind_ft.py
|
||||
+++ b/test/memkind_ft.py
|
||||
@@ -52,13 +52,13 @@ import xml.dom.minidom
|
||||
|
||||
if os.name == 'posix':
|
||||
Linux = True
|
||||
- HOST = "/usr/share/mpss/test/memkind-dt/"
|
||||
+ tests_home = "/usr/share/mpss/test/memkind-dt/"
|
||||
slash = "/"
|
||||
else:
|
||||
import _winreg
|
||||
Linux = False
|
||||
mpss_home = os.environ.get("INTEL_MPSS_HOME")
|
||||
- HOST = mpss_home + "test\\windows-memkind-dt\\"
|
||||
+ tests_home = mpss_home + "test\\windows-memkind-dt\\"
|
||||
slash = "\\"
|
||||
|
||||
def setup_logging(name):
|
||||
@@ -203,19 +203,10 @@ if __name__ == "__main__":
|
||||
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
- if Linux:
|
||||
- cmd = './' + sys.argv[1]
|
||||
- else:
|
||||
- cmd = sys.argv[1]
|
||||
+ cmd = tests_home + sys.argv[1]
|
||||
|
||||
- if Linux:
|
||||
- if opts.list:
|
||||
- shutil.copy(HOST+sys.argv[1], source)
|
||||
- cmd = cmd + " --gtest_list_tests"
|
||||
- else:
|
||||
- if opts.list:
|
||||
- shutil.copy(HOST+sys.argv[1]+'.exe', source)
|
||||
- cmd = cmd + " --gtest_list_tests"
|
||||
+ if opts.list:
|
||||
+ cmd = cmd + " --gtest_list_tests"
|
||||
|
||||
if opts.time:
|
||||
sys.exit()
|
||||
@@ -239,9 +230,9 @@ if __name__ == "__main__":
|
||||
test_main = test
|
||||
else: #Run test command
|
||||
if "SchedGeTest" in test_main:
|
||||
- test_cmd = "LD_PRELOAD="+HOST+"libsched.so ./schedcpu_test" + " --gtest_output=xml:" + xmlt
|
||||
+ test_cmd = "LD_PRELOAD=" + tests_home + "libsched.so " + tests_home + "schedcpu_test" + " --gtest_output=xml:" + xmlt
|
||||
elif "TiedDistTest" in test_main:
|
||||
- test_cmd = "LD_PRELOAD="+HOST+"libnumadist.so ./tieddisterr_test" + " --gtest_output=xml:" + xmlt
|
||||
+ test_cmd = "LD_PRELOAD=" + tests_home + "libnumadist.so " + tests_home + "tieddisterr_test" + " --gtest_output=xml:" + xmlt
|
||||
else:
|
||||
test_cmd = cmd + " --gtest_filter=" +test_main+test + " --gtest_output=xml:" + xmlt
|
||||
print test_cmd
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,80 +0,0 @@
|
||||
From 0de5d76fa06c027ff17790c871e57c939b14bea4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0de5d76fa06c027ff17790c871e57c939b14bea4.1432566145.git.aquini@redhat.com>
|
||||
In-Reply-To: <74f8dd6193fe1ae1e475452a76f9c4daaf602a63.1432566145.git.aquini@redhat.com>
|
||||
References: <74f8dd6193fe1ae1e475452a76f9c4daaf602a63.1432566145.git.aquini@redhat.com>
|
||||
From: Rafael Aquini <aquini@redhat.com>
|
||||
Date: Mon, 25 May 2015 10:31:01 -0400
|
||||
Subject: [PATCH 2/2] memkind: configure.ac fix obsolete macro usage warnings
|
||||
|
||||
This patch adjusts memkind's configure.ac file to get rid of the following
|
||||
warnings when autotools are executed with '-Wobsolete' flag
|
||||
|
||||
-- >8 --
|
||||
$ ./autogen.sh
|
||||
~/rpmbuild/BUILD/memkind-a0dfc8ad94960babcdaf99063164f9b64b1092e4/jemalloc ~/rpmbuild/BUILD/memkind-a0dfc8ad94960babcdaf99063164f9b64b1092e4
|
||||
~/rpmbuild/BUILD/memkind-a0dfc8ad94960babcdaf99063164f9b64b1092e4
|
||||
configure.ac:140: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
|
||||
configure.ac:140: You should run autoupdate.
|
||||
m4/libtool.m4:107: AC_PROG_LIBTOOL is expanded from...
|
||||
configure.ac:140: the top level
|
||||
configure.ac:178: warning: AC_OUTPUT should be used without arguments.
|
||||
configure.ac:178: You should run autoupdate.
|
||||
libtoolize: putting auxiliary files in `.'.
|
||||
libtoolize: copying file `./ltmain.sh'
|
||||
libtoolize: putting macros in `m4'.
|
||||
libtoolize: copying file `m4/libtool.m4'
|
||||
libtoolize: copying file `m4/ltoptions.m4'
|
||||
libtoolize: copying file `m4/ltsugar.m4'
|
||||
libtoolize: copying file `m4/ltversion.m4'
|
||||
libtoolize: copying file `m4/lt~obsolete.m4'
|
||||
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
|
||||
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
|
||||
libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
|
||||
configure.ac:140: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
|
||||
configure.ac:140: You should run autoupdate.
|
||||
m4/libtool.m4:107: AC_PROG_LIBTOOL is expanded from...
|
||||
configure.ac:140: the top level
|
||||
configure.ac:178: warning: AC_OUTPUT should be used without arguments.
|
||||
configure.ac:178: You should run autoupdate.
|
||||
-- 8< --
|
||||
|
||||
Signed-off-by: Rafael Aquini <aquini@redhat.com>
|
||||
---
|
||||
configure.ac | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 465eba9..24c7840 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -30,6 +30,7 @@ AC_INIT([memkind],m4_esyscmd([tr -d '\n' < VERSION]),[christopher.m.cantalupo@in
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_HEADERS([config_tls.h])
|
||||
+AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
memkind_abi_version=0:1:0
|
||||
AC_SUBST(memkind_abi_version)
|
||||
@@ -137,8 +138,7 @@ AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
-AC_PROG_LIBTOOL
|
||||
-AC_PROG_RANLIB
|
||||
+LT_INIT
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
# Checks for libraries.
|
||||
@@ -175,7 +175,8 @@ AC_FUNC_MMAP
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([gettimeofday memset mkdir munmap setenv strtol strtoul])
|
||||
|
||||
-AC_OUTPUT(Makefile)
|
||||
+AC_CONFIG_FILES([Makefile])
|
||||
+AC_OUTPUT
|
||||
|
||||
# ============================================================================
|
||||
# Print out the results of configuration.
|
||||
--
|
||||
2.1.0
|
||||
|
120
0003-Fixed-memkind_hugetlb_check_available-which-was-retu.patch
Normal file
120
0003-Fixed-memkind_hugetlb_check_available-which-was-retu.patch
Normal file
@ -0,0 +1,120 @@
|
||||
From b2936251deeba22d4235cbdc4210cef07c4e99c2 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b2936251deeba22d4235cbdc4210cef07c4e99c2.1454769807.git.aquini@redhat.com>
|
||||
In-Reply-To: <6aacbbcbb67cbc45eee780eb9765bd066e299f19.1454769807.git.aquini@redhat.com>
|
||||
References: <6aacbbcbb67cbc45eee780eb9765bd066e299f19.1454769807.git.aquini@redhat.com>
|
||||
From: =?UTF-8?q?Krzysztof=20Ku=C5=82akowski?=
|
||||
<krzysztof.kulakowski@intel.com>
|
||||
Date: Thu, 22 Oct 2015 12:24:03 +0200
|
||||
Subject: [PATCH 3/3] Fixed memkind_hugetlb_check_available() which was
|
||||
returning error despite the fact that nr_overcommit_hugepages was set to
|
||||
positive value.
|
||||
|
||||
---
|
||||
src/memkind_hugetlb.c | 67 ++++++++++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 48 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/memkind_hugetlb.c b/src/memkind_hugetlb.c
|
||||
index 9c8dd96..c59c97f 100644
|
||||
--- a/src/memkind_hugetlb.c
|
||||
+++ b/src/memkind_hugetlb.c
|
||||
@@ -68,7 +68,6 @@ void memkind_hugetlb_init_once(void)
|
||||
assert(err == 0);
|
||||
}
|
||||
|
||||
-
|
||||
int memkind_hugetlb_check_available_2mb(struct memkind *kind)
|
||||
{
|
||||
return memkind_hugetlb_check_available(kind, 2097152);
|
||||
@@ -86,20 +85,42 @@ static int memkind_hugetlb_check_available(struct memkind *kind, size_t huge_siz
|
||||
int errno_before;
|
||||
int num_read = 0;
|
||||
unsigned int node, num_node;
|
||||
- size_t nr_hugepages = 0;
|
||||
FILE *fid = NULL;
|
||||
nodemask_t nodemask;
|
||||
struct bitmask nodemask_bm = {NUMA_NUM_NODES, nodemask.n};
|
||||
+ char formatted_path[128];
|
||||
+ int snprintf_ret = 0;
|
||||
+ size_t value_read = 0;
|
||||
+
|
||||
+ size_t nr_persistent_hugepages = 0;
|
||||
const char *nr_path_fmt = "/sys/devices/system/node/node%u/hugepages/hugepages-%zukB/nr_hugepages";
|
||||
- char nr_path[128];
|
||||
|
||||
- /* default huge page size is 2MB */
|
||||
+ size_t nr_overcommit_hugepages = 0;
|
||||
+ const char *nr_overcommit_path_fmt = "/sys/kernel/mm/hugepages/hugepages-%zukB/nr_overcommit_hugepages";
|
||||
+
|
||||
+ /* on x86 default huge page size is 2MB */
|
||||
if (huge_size == 0) {
|
||||
- huge_size = 2048;
|
||||
+ huge_size = 2097152;
|
||||
}
|
||||
+
|
||||
/* convert input to kB */
|
||||
- else {
|
||||
- huge_size = huge_size >> 10;
|
||||
+ huge_size >>= 10;
|
||||
+
|
||||
+ //read overcommit hugepages limit for this pagesize
|
||||
+ snprintf_ret = snprintf(formatted_path, sizeof(formatted_path), nr_overcommit_path_fmt, huge_size);
|
||||
+ if (snprintf_ret > 0 && snprintf_ret < sizeof(formatted_path)) {
|
||||
+ errno_before = errno;
|
||||
+ fid = fopen(formatted_path, "r");
|
||||
+ if (fid) {
|
||||
+ num_read = fscanf(fid, "%zud", &value_read);
|
||||
+ if(num_read) {
|
||||
+ nr_overcommit_hugepages = value_read;
|
||||
+ }
|
||||
+ fclose(fid);
|
||||
+ }
|
||||
+ else {
|
||||
+ errno = errno_before;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (kind->ops->get_mbind_nodemask) {
|
||||
@@ -111,20 +132,28 @@ static int memkind_hugetlb_check_available(struct memkind *kind, size_t huge_siz
|
||||
num_node = numa_num_configured_nodes();
|
||||
for (node = 0; !err && node < num_node; ++node) {
|
||||
if (numa_bitmask_isbitset(&nodemask_bm, node)) {
|
||||
- snprintf(nr_path, 128, nr_path_fmt, node, huge_size);
|
||||
- errno_before = errno;
|
||||
- fid = fopen(nr_path, "r");
|
||||
- if (!fid) {
|
||||
- err = MEMKIND_ERROR_HUGETLB;
|
||||
- errno = errno_before;
|
||||
- }
|
||||
- else {
|
||||
- num_read = fscanf(fid, "%zud", &nr_hugepages);
|
||||
- fclose(fid);
|
||||
- if (!num_read || !nr_hugepages) {
|
||||
- err = MEMKIND_ERROR_HUGETLB;
|
||||
+ nr_persistent_hugepages = 0;
|
||||
+ snprintf_ret = snprintf(formatted_path, sizeof(formatted_path), nr_path_fmt, node, huge_size);
|
||||
+ if(snprintf_ret > 0 && snprintf_ret < sizeof(formatted_path)) {
|
||||
+ errno_before = errno;
|
||||
+ fid = fopen(formatted_path, "r");
|
||||
+ if (fid) {
|
||||
+ num_read = fscanf(fid, "%zud", &value_read);
|
||||
+ if(num_read) {
|
||||
+ nr_persistent_hugepages = value_read;
|
||||
+ }
|
||||
+ fclose(fid);
|
||||
+ }
|
||||
+ else {
|
||||
+ errno = errno_before;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ //return error if there is no overcommit limit for that page size
|
||||
+ //nor persistent hugepages for nodes of that kind
|
||||
+ if (!nr_overcommit_hugepages && !nr_persistent_hugepages) {
|
||||
+ err = MEMKIND_ERROR_HUGETLB;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
return err;
|
||||
--
|
||||
2.5.0
|
||||
|
27
f24-build-fixlet.patch
Normal file
27
f24-build-fixlet.patch
Normal file
@ -0,0 +1,27 @@
|
||||
diff --git a/src/memkind_hbw.c b/src/memkind_hbw.c
|
||||
index e5bf5ea..82908d7 100644
|
||||
--- a/src/memkind_hbw.c
|
||||
+++ b/src/memkind_hbw.c
|
||||
@@ -44,6 +44,9 @@
|
||||
#include "memkind_hugetlb.h"
|
||||
#include "memkind_arena.h"
|
||||
|
||||
+
|
||||
+const char *MEMKIND_BANDWIDTH_PATH = "/var/run/memkind/node-bandwidth";
|
||||
+
|
||||
const struct memkind_ops MEMKIND_HBW_OPS = {
|
||||
.create = memkind_arena_create,
|
||||
.destroy = memkind_arena_destroy,
|
||||
diff --git a/src/memkind_hbw.h b/src/memkind_hbw.h
|
||||
index 1ba8590..8de7f58 100644
|
||||
--- a/src/memkind_hbw.h
|
||||
+++ b/src/memkind_hbw.h
|
||||
@@ -30,7 +30,7 @@ extern "C" {
|
||||
|
||||
#include "memkind.h"
|
||||
|
||||
-static const char * const MEMKIND_BANDWIDTH_PATH = "/var/run/memkind/node-bandwidth";
|
||||
+extern const char *MEMKIND_BANDWIDTH_PATH;
|
||||
|
||||
int memkind_hbw_check_available(struct memkind *kind);
|
||||
int memkind_hbw_hugetlb_check_available(struct memkind *kind);
|
37
memkind.spec
37
memkind.spec
@ -3,12 +3,12 @@
|
||||
Name: memkind
|
||||
Summary: User Extensible Heap Manager
|
||||
Version: 0.3.0
|
||||
Release: 3%{?checkout}%{?dist}
|
||||
Release: 4%{?checkout}%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Libraries
|
||||
URL: http://memkind.github.io/memkind
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: automake libtool numactl-devel
|
||||
BuildRequires: automake libtool numactl-devel systemd
|
||||
|
||||
# x86_64 is the only arch memkind will build and work due to
|
||||
# its current dependency on SSE4.2 CRC32 instruction which
|
||||
@ -21,6 +21,15 @@ BuildRequires: automake libtool numactl-devel
|
||||
ExclusiveArch: x86_64
|
||||
|
||||
Source0: https://github.com/%{name}/%{name}/archive/%{gittag0}/%{name}-%{version}.tar.gz
|
||||
# Upstream ordinary fixes to v0.3.0
|
||||
Patch0: 0001-Treshold-calculation-fixed.patch
|
||||
Patch1: 0002-Execute-tests-from-package-installation-directory.patch
|
||||
Patch2: 0003-Fixed-memkind_hugetlb_check_available-which-was-retu.patch
|
||||
# Systemd service unit file backport
|
||||
# from upstream commit 09cc9b254f39ea5c9dfeeaec9067b0fc13af07a9
|
||||
Patch3: systemd-service-backport.patch
|
||||
# Build error fixlet
|
||||
Patch4: f24-build-fixlet.patch
|
||||
|
||||
%description
|
||||
The memkind library is an user extensible heap manager built on top of
|
||||
@ -53,6 +62,11 @@ alpha release. Feedback on design or implementation is greatly appreciated.
|
||||
|
||||
%prep
|
||||
%setup -q -a 0 -n %{name}-%{version}
|
||||
%patch0 -p1 -b .patch0.bkp
|
||||
%patch1 -p1 -b .patch1.bkp
|
||||
%patch2 -p1 -b .patch2.bkp
|
||||
%patch3 -p1 -b .patch3.bkp
|
||||
%patch4 -p1 -b .patch4.bkp
|
||||
|
||||
%build
|
||||
# It is required that we configure and build the jemalloc subdirectory
|
||||
@ -87,13 +101,20 @@ test -f configure || ./autogen.sh
|
||||
|
||||
%install
|
||||
cd %{_builddir}/%{name}-%{version}
|
||||
%{__make} DESTDIR=%{buildroot} install
|
||||
make install DESTDIR=%{buildroot} INSTALL='install -p'
|
||||
install -Dpm 644 %{name}.service %{buildroot}/%{_unitdir}/%{name}.service
|
||||
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}
|
||||
mkdir -p %{buildroot}/%{_localstatedir}/run/%{name}
|
||||
rm -f %{buildroot}/%{_libdir}/lib%{name}.{l,}a
|
||||
rm -f %{buildroot}/%{_libdir}/lib{numakind,autohbw}.*
|
||||
rm -f %{buildroot}/%{_docdir}/%{name}/VERSION
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
touch %{_localstatedir}/run/%{name}/node-bandwidth
|
||||
|
||||
%preun
|
||||
rm -f %{_localstatedir}/run/%{name}/node-bandwidth
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
@ -101,11 +122,12 @@ rm -f %{buildroot}/%{_docdir}/%{name}/VERSION
|
||||
%defattr(-,root,root,-)
|
||||
%license %{_docdir}/%{name}/COPYING
|
||||
%doc %{_docdir}/%{name}/README
|
||||
%dir %{_sysconfdir}/%{name}
|
||||
%dir %{_docdir}/%{name}
|
||||
%ghost %dir %{_localstatedir}/run/%{name}
|
||||
%{_libdir}/lib%{name}.so.*
|
||||
%{_bindir}/%{name}-hbw-nodes
|
||||
%{_sbindir}/%{name}-pmtt
|
||||
%{_unitdir}/%{name}.service
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
@ -116,6 +138,11 @@ rm -f %{buildroot}/%{_docdir}/%{name}/VERSION
|
||||
%{_mandir}/man3/%{name}*.3.*
|
||||
|
||||
%changelog
|
||||
* Sat Feb 06 2016 Rafael Aquini <aquini@linux.com> - 0.3.0-4
|
||||
- Update upstream fixes for memkind-0.3.0
|
||||
- Switch old init.d scripts for systemd unit service
|
||||
- Fix fc24 build error
|
||||
|
||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
|
2
sources
2
sources
@ -1,3 +1 @@
|
||||
5297a615a607154e67d4989652b5f1d0 jemalloc-8a46c970035ada0154f302418cb436de49606231.tar.gz
|
||||
552cbac904655882cabbdde1a13a7d64 memkind-35c83cee96432edc0b5b21680535a2f2b77a1801.tar.gz
|
||||
0deed6db57b11b8e325fea05256f7f6c memkind-0.3.0.tar.gz
|
||||
|
197
systemd-service-backport.patch
Normal file
197
systemd-service-backport.patch
Normal file
@ -0,0 +1,197 @@
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index f1dc47e..d687fd2 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -88,7 +88,7 @@ memkind_pmtt_SOURCES = src/memkind_pmtt.c
|
||||
memkind_pmtt_LDADD = libmemkind.la
|
||||
|
||||
EXTRA_DIST = autogen.sh \
|
||||
- init.d/memkind \
|
||||
+ memkind.service \
|
||||
gtest-1.7.0.zip \
|
||||
examples/README \
|
||||
test/check.sh \
|
||||
diff --git a/init.d/memkind b/init.d/memkind
|
||||
deleted file mode 100755
|
||||
index 4ef2f80..0000000
|
||||
--- a/init.d/memkind
|
||||
+++ /dev/null
|
||||
@@ -1,137 +0,0 @@
|
||||
-#!/bin/bash
|
||||
-#
|
||||
-# Copyright (C) 2014, 2015 Intel Corporation.
|
||||
-# All rights reserved.
|
||||
-#
|
||||
-# Redistribution and use in source and binary forms, with or without
|
||||
-# modification, are permitted provided that the following conditions are met:
|
||||
-# 1. Redistributions of source code must retain the above copyright notice(s),
|
||||
-# this list of conditions and the following disclaimer.
|
||||
-# 2. Redistributions in binary form must reproduce the above copyright notice(s),
|
||||
-# this list of conditions and the following disclaimer in the documentation
|
||||
-# and/or other materials provided with the distribution.
|
||||
-#
|
||||
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
|
||||
-# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
-# EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-#
|
||||
-#
|
||||
-# This shell script takes care creating and deleting accesible
|
||||
-# bandwidth files from PMTT tables
|
||||
-### BEGIN INIT INFO
|
||||
-# Provides: memkind
|
||||
-# Required-Start:
|
||||
-# Required-Stop:
|
||||
-# Short-Description: Sets up memkind library
|
||||
-# Description: Parses the PMTT table and creates the file /var/run/memkind/node-bandwidth.
|
||||
-#
|
||||
-# start - Create bandwidth file from PMTT table.
|
||||
-#
|
||||
-# stop - Delete bandwidth file from /var/run/memkind.
|
||||
-#
|
||||
-# restart - Delete and recreate bandwidth file from PMTT table.
|
||||
-#
|
||||
-# status - Print existance of bandwidth file
|
||||
-# Default-Start: 3 4 5
|
||||
-# Default-Stop: 0 1 2 6
|
||||
-### END INIT INFO
|
||||
-
|
||||
-if [ -s /etc/rc.status ]; then
|
||||
- . /etc/rc.status
|
||||
- echo_success() {
|
||||
- echo $1
|
||||
- rc_failed 0
|
||||
- rc_status -v1
|
||||
- }
|
||||
- echo_failure() {
|
||||
- echo $1
|
||||
- rc_failed 1
|
||||
- rc_status -v1
|
||||
- }
|
||||
-elif [ -s /etc/rc.d/init.d/functions ]; then
|
||||
- . /etc/rc.d/init.d/functions
|
||||
-else
|
||||
- echo_success() {
|
||||
- echo $1
|
||||
- }
|
||||
- echo_failure() {
|
||||
- echo ERROR: $1
|
||||
- }
|
||||
-fi
|
||||
-
|
||||
-err=0
|
||||
-MEMKIND_FILE=/var/run/memkind/node-bandwidth
|
||||
-MEMKIND_DIR=`dirname $MEMKIND_FILE`
|
||||
-MEMKIND_BIN=/usr/sbin/memkind-pmtt
|
||||
-
|
||||
-start() {
|
||||
- echo_success "creating bandwidth values file"
|
||||
- if [ -f $MEMKIND_FILE ]; then
|
||||
- echo_success "bandwidth values file exists, atemptting to delete before
|
||||
- creation."
|
||||
- stop
|
||||
- fi
|
||||
-
|
||||
- if [ ! -f $MEMKIND_FILE ]; then
|
||||
- $MEMKIND_BIN
|
||||
- err=$?
|
||||
- if [ $err -eq 0 ] && [ -f $MEMKIND_FILE ]
|
||||
- then
|
||||
- echo_success "created file: $MEMKIND_FILE"
|
||||
- else
|
||||
- echo_failure "could not create file: $MEMKIND_FILE"
|
||||
- fi
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
-stop() {
|
||||
- echo_success "deleting bandwidth values file"
|
||||
- rm -f $MEMKIND_FILE
|
||||
- err=$?
|
||||
- if [ $err -eq 0 ] && [ ! -f $MEMKIND_FILE ]
|
||||
- then
|
||||
- echo_success "deleted file: $MEMKIND_FILE"
|
||||
- else
|
||||
- echo_failure "could not delete file: $MEMKIND_FILE"
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
-restart() {
|
||||
- if [ -f $MEMKIND_FILE ]; then
|
||||
- stop
|
||||
- fi
|
||||
- start
|
||||
-}
|
||||
-
|
||||
-case $1 in
|
||||
- start)
|
||||
- start
|
||||
- ;;
|
||||
- stop)
|
||||
- stop
|
||||
- ;;
|
||||
- restart|force-reload|reload|condrestart|try-restart)
|
||||
- restart
|
||||
- ;;
|
||||
- status)
|
||||
- if [ -f $MEMKIND_FILE ];
|
||||
- then
|
||||
- echo_success "file $MEMKIND_FILE exists"
|
||||
- err=0
|
||||
- else
|
||||
- echo_failure "file $MEMKIND_FILE does not exist"
|
||||
- err=3
|
||||
- fi
|
||||
- ;;
|
||||
- *)
|
||||
- echo "Usage: $0 {start|stop|restart|status|force-reload|reload|condrestart|try-restart}"
|
||||
- err=2
|
||||
-esac
|
||||
-exit $err
|
||||
diff --git a/memkind.service b/memkind.service
|
||||
new file mode 100644
|
||||
index 0000000..4fcc39d
|
||||
--- /dev/null
|
||||
+++ b/memkind.service
|
||||
@@ -0,0 +1,35 @@
|
||||
+#
|
||||
+# Copyright (C) 2014, 2015 Intel Corporation.
|
||||
+# All rights reserved.
|
||||
+#
|
||||
+# Redistribution and use in source and binary forms, with or without
|
||||
+# modification, are permitted provided that the following conditions are met:
|
||||
+# 1. Redistributions of source code must retain the above copyright notice(s),
|
||||
+# this list of conditions and the following disclaimer.
|
||||
+# 2. Redistributions in binary form must reproduce the above copyright notice(s),
|
||||
+# this list of conditions and the following disclaimer in the documentation
|
||||
+# and/or other materials provided with the distribution.
|
||||
+#
|
||||
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
|
||||
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
+# EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+#
|
||||
+
|
||||
+[Unit]
|
||||
+Description=Service which parses PMTT table for memkind
|
||||
+
|
||||
+[Service]
|
||||
+Type=oneshot
|
||||
+RemainAfterExit=yes
|
||||
+ExecStart=/usr/sbin/memkind-pmtt
|
||||
+ExecStop=/usr/bin/rm -f /var/run/memkind/node-bandwidth
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user