Update memkind source file to 1.0.0 upstream
Signed-off-by: Rafael Aquini <aquini@linux.com>
This commit is contained in:
parent
e1a90f93aa
commit
7f4ab054f4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
/jemalloc-8a46c970035ada0154f302418cb436de49606231.tar.gz
|
||||
/memkind-35c83cee96432edc0b5b21680535a2f2b77a1801.tar.gz
|
||||
/memkind-0.3.0.tar.gz
|
||||
/memkind-1.0.0.tar.gz
|
||||
|
@ -1,138 +0,0 @@
|
||||
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,70 +0,0 @@
|
||||
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,120 +0,0 @@
|
||||
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
|
||||
|
@ -1,27 +0,0 @@
|
||||
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);
|
32
memkind.spec
32
memkind.spec
@ -1,9 +1,9 @@
|
||||
%global gittag0 v0.3.0
|
||||
%global gittag0 v1.0.0
|
||||
|
||||
Name: memkind
|
||||
Summary: User Extensible Heap Manager
|
||||
Version: 0.3.0
|
||||
Release: 5%{?checkout}%{?dist}
|
||||
Version: 1.0.0
|
||||
Release: 1%{?checkout}%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Libraries
|
||||
URL: http://memkind.github.io/memkind
|
||||
@ -22,17 +22,8 @@ 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
|
||||
# tmpfiles.d config for /var/run/memkind state dir and contents
|
||||
Patch5: memkind-tmpfiles.d.conf.patch
|
||||
Patch0: memkind-tmpfiles.d.conf.patch
|
||||
|
||||
|
||||
%description
|
||||
@ -66,12 +57,7 @@ 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
|
||||
%patch5 -p1 -b .patch5.bkp
|
||||
%patch0 -p1 -b .patch5.bkp
|
||||
|
||||
%build
|
||||
# It is required that we configure and build the jemalloc subdirectory
|
||||
@ -133,13 +119,21 @@ rm -f %{buildroot}/%{_docdir}/%{name}/VERSION
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_includedir}/%{name}
|
||||
%dir %{_includedir}/%{name}/internal/
|
||||
%{_includedir}/%{name}/internal/*.h
|
||||
%{_includedir}/%{name}*.h
|
||||
%{_includedir}/hbwmalloc.h
|
||||
%{_includedir}/hbw_allocator.h
|
||||
%{_libdir}/lib%{name}.so
|
||||
%{_mandir}/man3/hbwmalloc.3.*
|
||||
%{_mandir}/man3/hbwallocator.3.*
|
||||
%{_mandir}/man3/%{name}*.3.*
|
||||
|
||||
%changelog
|
||||
* Thu Mar 17 2016 Rafael Aquini <aquini@linux.com> - 1.0.0-1
|
||||
- Update memkind source file to 1.0.0 upstream
|
||||
|
||||
* Sun Feb 07 2016 Rafael Aquini <aquini@linux.com> - 0.3.0-5
|
||||
- Fix rpmlint error dir-or-file-in-var-run for /var/run/memkind
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
0deed6db57b11b8e325fea05256f7f6c memkind-0.3.0.tar.gz
|
||||
5d84ebff7bf0958aad8229ed0e63e2cc memkind-1.0.0.tar.gz
|
||||
|
@ -1,197 +0,0 @@
|
||||
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