forked from pool/numad
Accepting request 178908 from home:mgorman
Request inclusion of package with hardware project before submitting to Factory OBS-URL: https://build.opensuse.org/request/show/178908 OBS-URL: https://build.opensuse.org/package/show/hardware/numad?expand=0&rev=1
This commit is contained in:
commit
04680bb10f
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
36
mainline-sysfs-paths.patch
Normal file
36
mainline-sysfs-paths.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
From 40f348eacb1c9a27f19e35341b373e351164a054 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mel Gorman <mgorman@suse.de>
|
||||||
|
Date: Wed, 22 May 2013 14:41:40 +0100
|
||||||
|
Subject: [PATCH] Use sysfs configuration paths for mainline kernels
|
||||||
|
Upstream: no
|
||||||
|
|
||||||
|
The current recommended path for tuning THP is based on the RHEL kernel. Use
|
||||||
|
the mainline sysfs filenames.
|
||||||
|
|
||||||
|
Signed-off-by: Mel Gorman <mgorman@suse.de>
|
||||||
|
---
|
||||||
|
numad.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/numad.c b/numad.c
|
||||||
|
index 9262cab..c9c86f5 100644
|
||||||
|
--- a/numad.c
|
||||||
|
+++ b/numad.c
|
||||||
|
@@ -731,7 +731,7 @@ void check_prereqs(char *prog_name) {
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Check on THP scan sleep time.
|
||||||
|
- char *thp_scan_fname = "/sys/kernel/mm/redhat_transparent_hugepage/khugepaged/scan_sleep_millisecs";
|
||||||
|
+ char *thp_scan_fname = "/sys/kernel/mm/transparent_hugepage/khugepaged/scan_sleep_millisecs";
|
||||||
|
int fd = open(thp_scan_fname, O_RDONLY, 0);
|
||||||
|
if (fd >= 0) {
|
||||||
|
int ms;
|
||||||
|
@@ -748,7 +748,7 @@ void check_prereqs(char *prog_name) {
|
||||||
|
fprintf(stderr, "Consider increasing the frequency of THP scanning,\n");
|
||||||
|
fprintf(stderr, "by echoing a smaller number (e.g. 100) to %s\n", thp_scan_fname);
|
||||||
|
fprintf(stderr, "to more aggressively (re)construct THPs. For example:\n");
|
||||||
|
- fprintf(stderr, "# echo 100 > /sys/kernel/mm/redhat_transparent_hugepage/khugepaged/scan_sleep_millisecs\n");
|
||||||
|
+ fprintf(stderr, "# echo 100 > /sys/kernel/mm/transparent_hugepage/khugepaged/scan_sleep_millisecs\n");
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
}
|
BIN
numad-0.5.20130522.tar.bz2
(Stored with Git LFS)
Normal file
BIN
numad-0.5.20130522.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
202
numad-opensuse-init.patch
Normal file
202
numad-opensuse-init.patch
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
From 0f92675aadf2cd7a3db586f5b3ff507361e27b68 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mel Gorman <mgorman@suse.de>
|
||||||
|
Date: Thu, 23 May 2013 00:14:31 +0100
|
||||||
|
Subject: [PATCH] Make init script openSUSE friendly
|
||||||
|
|
||||||
|
Subject says it all, current init script is RHEL/Fedora based. Update
|
||||||
|
systemd service script to shutdown numad cleanly.
|
||||||
|
|
||||||
|
Signed-off-by: Mel Gorman <mgorman@suse.de>
|
||||||
|
|
||||||
|
diff --git a/numad.init b/numad.init
|
||||||
|
index 053bb07..de74a1b 100755
|
||||||
|
--- a/numad.init
|
||||||
|
+++ b/numad.init
|
||||||
|
@@ -1,109 +1,85 @@
|
||||||
|
#!/bin/bash
|
||||||
|
-# chkconfig: - 99 1
|
||||||
|
-# description: Control operation of numad which will monitor and
|
||||||
|
-# rebalance assignment of NUMA resources
|
||||||
|
+#
|
||||||
|
+# /etc/init.d/numad
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: numad
|
||||||
|
-# Required-Start: cgconfig
|
||||||
|
-# Required-Stop:
|
||||||
|
+# Required-Start: $remote_fs
|
||||||
|
+# Required-Stop: $remote_fs
|
||||||
|
# Should-Start:
|
||||||
|
# Should-Stop:
|
||||||
|
-# Default-Start:
|
||||||
|
-# Default-Stop:
|
||||||
|
-# Short-Description: numad control
|
||||||
|
-# Description:
|
||||||
|
+# Default-Start: 3 5
|
||||||
|
+# Default-Stop: 0 1 2 6
|
||||||
|
+# Short-Description: numad daemon recommends or binds workloads to NUMA nodes
|
||||||
|
+# Description: numad is a userspace daemon that monitors NUMA usage
|
||||||
|
+# and resource usage and attempts to configure workloads
|
||||||
|
+# using cpusets to use a subset of CPUs and memory nodes
|
||||||
|
+# to maximise the number local memory access for best
|
||||||
|
+# performance. Alternatively, it can be used to give
|
||||||
|
+# hints as to how workloads should be manually bound
|
||||||
|
+# to CPUs and memory nodes.
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
-if [ $(id -u) -ne 0 ]; then
|
||||||
|
- echo "This script can be run by root only. Exiting."
|
||||||
|
- exit 4
|
||||||
|
-fi
|
||||||
|
+NUMAD_BIN=/usr/sbin/numad
|
||||||
|
+NUMAD_CONFIG=/etc/numad.conf
|
||||||
|
|
||||||
|
-# Source function library.
|
||||||
|
-. /etc/rc.d/init.d/functions
|
||||||
|
+. /etc/rc.status
|
||||||
|
+LOCKFILE=${PIDFILE}.lock
|
||||||
|
|
||||||
|
-exec="/usr/bin/numad"
|
||||||
|
-prog="numad"
|
||||||
|
-config="/etc/numad.conf"
|
||||||
|
+# Reset status of this service
|
||||||
|
+rc_reset
|
||||||
|
|
||||||
|
-[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||||
|
-
|
||||||
|
-lockfile=/var/lock/subsys/$prog
|
||||||
|
-base=${0##*/}
|
||||||
|
-
|
||||||
|
-start() {
|
||||||
|
- [ -x $exec ] || exit 5
|
||||||
|
- [ -f $config ] || exit 6
|
||||||
|
- echo -n $"Starting $prog: "
|
||||||
|
- . $config
|
||||||
|
- daemon "$exec -i $INTERVAL"
|
||||||
|
- retval=$?
|
||||||
|
- echo
|
||||||
|
- [ $retval -eq 0 ] && touch $lockfile
|
||||||
|
- return $retval
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-stop() {
|
||||||
|
- echo -n $"Stopping $prog: "
|
||||||
|
- killproc $prog
|
||||||
|
- retval=$?
|
||||||
|
- echo
|
||||||
|
- [ $retval -eq 0 ] && rm -f $lockfile
|
||||||
|
- return $retval
|
||||||
|
-}
|
||||||
|
+case "$1" in
|
||||||
|
+start)
|
||||||
|
+ test -x $NUMAD_BIN || exit 5
|
||||||
|
+ test -f $NUMAD_CONFIG || exit 6
|
||||||
|
+ echo -n "Starting numad "
|
||||||
|
+ . $NUMAD_CONFIG
|
||||||
|
+ $NUMAD_BIN -i $INTERVAL
|
||||||
|
+ echo $! > "$PIDFILE"
|
||||||
|
+ touch "$LOCKFILE"
|
||||||
|
+ rc_status -v
|
||||||
|
+ ;;
|
||||||
|
|
||||||
|
-restart() {
|
||||||
|
- stop
|
||||||
|
- start
|
||||||
|
-}
|
||||||
|
+stop)
|
||||||
|
+ echo -n "Shutting down numad "
|
||||||
|
+ $NUMAD_BIN -i 0
|
||||||
|
+ RETVAL=$?
|
||||||
|
+ rc_status
|
||||||
|
+ if [ $RETVAL -eq 0 ]; then
|
||||||
|
+ rm -f "$LOCKFILE" "$PIDFILE"
|
||||||
|
+ fi
|
||||||
|
+ ;;
|
||||||
|
|
||||||
|
-reload() {
|
||||||
|
- restart
|
||||||
|
-}
|
||||||
|
+try-restart)
|
||||||
|
+ $0 status > /dev/null && $0 restart
|
||||||
|
+ rc_status
|
||||||
|
+ ;;
|
||||||
|
|
||||||
|
-force_reload() {
|
||||||
|
- restart
|
||||||
|
-}
|
||||||
|
+restart)
|
||||||
|
+ $0 stop
|
||||||
|
+ $0 start
|
||||||
|
+ rc_status
|
||||||
|
+ ;;
|
||||||
|
|
||||||
|
-rh_status() {
|
||||||
|
- # run checks to determine if the service is running or use generic status
|
||||||
|
- status $prog
|
||||||
|
-}
|
||||||
|
+reload)
|
||||||
|
+ $0 restart
|
||||||
|
+ ;;
|
||||||
|
|
||||||
|
-rh_status_q() {
|
||||||
|
- rh_status >/dev/null 2>&1
|
||||||
|
-}
|
||||||
|
+force_reload)
|
||||||
|
+ echo -n "Reload numad "
|
||||||
|
+ $0 restart
|
||||||
|
+ ;;
|
||||||
|
|
||||||
|
+status)
|
||||||
|
+ echo -n "Checking for numad "
|
||||||
|
+ check_proc "$PIDFILE" "$LOCKFILE"
|
||||||
|
|
||||||
|
-case "$1" in
|
||||||
|
- start)
|
||||||
|
- rh_status_q && exit 0
|
||||||
|
- $1
|
||||||
|
- ;;
|
||||||
|
- stop)
|
||||||
|
- rh_status_q || exit 0
|
||||||
|
- $1
|
||||||
|
- ;;
|
||||||
|
- restart)
|
||||||
|
- $1
|
||||||
|
- ;;
|
||||||
|
- reload)
|
||||||
|
- rh_status_q || exit 7
|
||||||
|
- $1
|
||||||
|
- ;;
|
||||||
|
- force-reload)
|
||||||
|
- force_reload
|
||||||
|
- ;;
|
||||||
|
- status)
|
||||||
|
- rh_status
|
||||||
|
- ;;
|
||||||
|
- condrestart|try-restart)
|
||||||
|
- rh_status_q || exit 0
|
||||||
|
- restart
|
||||||
|
- ;;
|
||||||
|
- *)
|
||||||
|
- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||||
|
- exit 2
|
||||||
|
+ rc_status -v
|
||||||
|
+ ;;
|
||||||
|
+*)
|
||||||
|
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
||||||
|
+ exit 1
|
||||||
|
+ ;;
|
||||||
|
esac
|
||||||
|
-exit $?
|
||||||
|
+rc_exit
|
||||||
|
diff --git a/numad.service b/numad.service
|
||||||
|
index 3f096d8..faf51ef 100644
|
||||||
|
--- a/numad.service
|
||||||
|
+++ b/numad.service
|
||||||
|
@@ -6,6 +6,7 @@ After=syslog.target
|
||||||
|
Type=forking
|
||||||
|
EnvironmentFile=/etc/numad.conf
|
||||||
|
ExecStart=/usr/sbin/numad -i $INTERVAL
|
||||||
|
+ExecStop=/usr/sbin/numad -i 0
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
33
numad-opensuse-systemd.patch
Normal file
33
numad-opensuse-systemd.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 5e83c0ab0c37e69bea4c3c0493ff5d05763551ec Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mel Gorman <mgorman@suse.de>
|
||||||
|
Date: Tue, 11 Jun 2013 09:00:28 +0100
|
||||||
|
Subject: [PATCH] Make systemd service file openSUSE friendly
|
||||||
|
|
||||||
|
Subject says it all. The After target is unnecessary and systemd should
|
||||||
|
be informed what the PIDFile of the process is.
|
||||||
|
|
||||||
|
Signed-off-by: Mel Gorman <mgorman@suse.de>
|
||||||
|
---
|
||||||
|
numad.service | 4 +---
|
||||||
|
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/numad.service b/numad.service
|
||||||
|
index faf51ef..d0c8c5b 100644
|
||||||
|
--- a/numad.service
|
||||||
|
+++ b/numad.service
|
||||||
|
@@ -1,14 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=numad - The NUMA daemon that manages application locality.
|
||||||
|
-After=syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
+PIDFile=/var/run/numad.pid
|
||||||
|
EnvironmentFile=/etc/numad.conf
|
||||||
|
ExecStart=/usr/sbin/numad -i $INTERVAL
|
||||||
|
ExecStop=/usr/sbin/numad -i 0
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
-
|
||||||
|
-
|
23
numad-rpm-opt-flags.patch
Normal file
23
numad-rpm-opt-flags.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
From f729ac3a9c9e50351ba7a0c604cbee6013ef2d87 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mel Gorman <mgorman@suse.de>
|
||||||
|
Date: Wed, 29 May 2013 11:26:02 +0100
|
||||||
|
Subject: [PATCH] Suppress an rpmlint warning related to RPM_OPT_FLAGS
|
||||||
|
|
||||||
|
Making depends does not appear to require the flags but rpmlint complains
|
||||||
|
so keep it happy.
|
||||||
|
|
||||||
|
Signed-off-by: Mel Gorman <mgorman@suse.de>
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index d6134f8..f695e73 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -58,7 +58,7 @@ distclean: clean
|
||||||
|
depend: .depend
|
||||||
|
|
||||||
|
.depend:
|
||||||
|
- ${CC} -MM -DDEPS_RUN -I. ${SOURCES} > .depend.X && mv .depend.X .depend
|
||||||
|
+ ${CC} ${CFLAGS} -MM -DDEPS_RUN -I. ${SOURCES} > .depend.X && mv .depend.X .depend
|
||||||
|
|
||||||
|
include .depend
|
||||||
|
|
42
numad-sbindir.patch
Normal file
42
numad-sbindir.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
From 746214b0903025b4d36b3fffe915d02bb72a0b47 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mel Gorman <mgorman@suse.de>
|
||||||
|
Date: Thu, 23 May 2013 00:16:27 +0100
|
||||||
|
Subject: [PATCH] Install numad to sbin
|
||||||
|
|
||||||
|
numad requires root privileges so install it to sbin
|
||||||
|
|
||||||
|
Signed-off-by: Mel Gorman <mgorman@suse.de>
|
||||||
|
---
|
||||||
|
Makefile | 4 ++--
|
||||||
|
numad.service | 2 +-
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index f1e64cc..07539d5 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -41,9 +41,9 @@ RANLIB ?= ranlib
|
||||||
|
# BB_FIXME MANPAGES := numa.3 numactl.8 numastat.8 migratepages.8 migspeed.8
|
||||||
|
|
||||||
|
install: numad
|
||||||
|
- mkdir -p ${prefix}/bin
|
||||||
|
+ mkdir -p ${prefix}/sbin
|
||||||
|
mkdir -p ${prefix}/share/man/man8
|
||||||
|
- install -m 0755 numad ${prefix}/bin
|
||||||
|
+ install -m 0755 numad ${prefix}/sbin
|
||||||
|
install -m 0644 numad.8 ${prefix}/share/man/man8
|
||||||
|
|
||||||
|
clean:
|
||||||
|
diff --git a/numad.service b/numad.service
|
||||||
|
index 478559a..3f096d8 100644
|
||||||
|
--- a/numad.service
|
||||||
|
+++ b/numad.service
|
||||||
|
@@ -5,7 +5,7 @@ After=syslog.target
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
EnvironmentFile=/etc/numad.conf
|
||||||
|
-ExecStart=/usr/bin/numad -i $INTERVAL
|
||||||
|
+ExecStart=/usr/sbin/numad -i $INTERVAL
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
120
numad-systemd-simple-type.patch
Normal file
120
numad-systemd-simple-type.patch
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
From b1d3aef655509d7debc651ff54226e4b067db3f4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mel Gorman <mgorman@suse.de>
|
||||||
|
Date: Wed, 12 Jun 2013 15:53:26 +0100
|
||||||
|
Subject: [PATCH] Give an option of running in foreground mode
|
||||||
|
|
||||||
|
systemd forking service type smells of something unfortunate apparently
|
||||||
|
and a desire was expressed to have it run as a simple service with
|
||||||
|
a foreground mode option. This patch implements a -F flag and uses it
|
||||||
|
with systemd.
|
||||||
|
|
||||||
|
Signed-off-by: Mel Gorman <mgorman@suse.de>
|
||||||
|
---
|
||||||
|
numad.8 | 5 ++++-
|
||||||
|
numad.c | 30 ++++++++++++++++++++----------
|
||||||
|
numad.service | 5 ++---
|
||||||
|
3 files changed, 26 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/numad.8 b/numad.8
|
||||||
|
index 2c46f55..73a0bc9 100644
|
||||||
|
--- a/numad.8
|
||||||
|
+++ b/numad.8
|
||||||
|
@@ -5,7 +5,7 @@ numad \- A user\-level daemon that provides placement advice and process
|
||||||
|
management for efficient use of CPUs and memory on systems with NUMA topology.
|
||||||
|
.SH "SYNTAX"
|
||||||
|
.LP
|
||||||
|
-numad [\fI\-dhvV\fP]
|
||||||
|
+numad [\fI\-dFhvV\fP]
|
||||||
|
.br
|
||||||
|
.LP
|
||||||
|
numad [\fI\-D non-standard-cgroup-mount-point\fP]
|
||||||
|
@@ -61,6 +61,9 @@ Debug output in log, sets the log level to LOG_DEBUG. Same effect as \fI\-l 7\f
|
||||||
|
\fB\-D\fR <\fInon-standard-cgroup-mount-point\fP>
|
||||||
|
This option can be used to communicate a non-standard cgroup mount point to
|
||||||
|
numad. This is not normally necessary.
|
||||||
|
+.TP
|
||||||
|
+\fB\-F\fR
|
||||||
|
+Run in foreground mode, do not daemonize\fP.
|
||||||
|
.TP
|
||||||
|
\fB\-h\fR
|
||||||
|
Display usage help information and then exit.
|
||||||
|
diff --git a/numad.c b/numad.c
|
||||||
|
index d08b622..f6581c0 100644
|
||||||
|
--- a/numad.c
|
||||||
|
+++ b/numad.c
|
||||||
|
@@ -680,6 +680,7 @@ void print_usage_and_exit(char *prog_name) {
|
||||||
|
fprintf(stderr, "Usage: %s <options> ...\n", prog_name);
|
||||||
|
fprintf(stderr, "-d for debug logging (same effect as '-l 7')\n");
|
||||||
|
fprintf(stderr, "-D <CGROUP_MOUNT_POINT> to specify cgroup mount point\n");
|
||||||
|
+ fprintf(stderr, "-F to run in the foreground\n");
|
||||||
|
fprintf(stderr, "-h to print this usage info\n");
|
||||||
|
fprintf(stderr, "-i [<MIN>:]<MAX> to specify interval seconds\n");
|
||||||
|
fprintf(stderr, "-K 1 to keep interleaved memory spread across nodes\n");
|
||||||
|
@@ -2145,8 +2146,9 @@ int main(int argc, char *argv[]) {
|
||||||
|
int v_flag = 0;
|
||||||
|
int w_flag = 0;
|
||||||
|
int x_flag = 0;
|
||||||
|
+ int F_flag = 0;
|
||||||
|
long list_pid = 0;
|
||||||
|
- while ((opt = getopt(argc, argv, "dD:hi:K:l:p:r:S:u:vVw:x:")) != -1) {
|
||||||
|
+ while ((opt = getopt(argc, argv, "dFD:hi:K:l:p:r:S:u:vVw:x:")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'd':
|
||||||
|
d_flag = 1;
|
||||||
|
@@ -2155,6 +2157,9 @@ int main(int argc, char *argv[]) {
|
||||||
|
case 'D':
|
||||||
|
cpuset_dir_list[0] = strdup(optarg);
|
||||||
|
break;
|
||||||
|
+ case 'F':
|
||||||
|
+ F_flag = 1;
|
||||||
|
+ break;
|
||||||
|
case 'h':
|
||||||
|
print_usage_and_exit(argv[0]);
|
||||||
|
break;
|
||||||
|
@@ -2278,15 +2283,20 @@ int main(int argc, char *argv[]) {
|
||||||
|
} else if (max_interval > 0) {
|
||||||
|
// Start the numad daemon...
|
||||||
|
check_prereqs(argv[0]);
|
||||||
|
- // Daemonize self...
|
||||||
|
- daemon_pid = fork();
|
||||||
|
- if (daemon_pid < 0) { numad_log(LOG_CRIT, "fork() failed\n"); exit(EXIT_FAILURE); }
|
||||||
|
- // Parent process now exits
|
||||||
|
- if (daemon_pid > 0) { exit(EXIT_SUCCESS); }
|
||||||
|
- // Child process continues...
|
||||||
|
- umask(S_IWGRP | S_IWOTH); // Reset the file mode
|
||||||
|
- int sid = setsid(); // Start a new session
|
||||||
|
- if (sid < 0) { numad_log(LOG_CRIT, "setsid() failed\n"); exit(EXIT_FAILURE); }
|
||||||
|
+
|
||||||
|
+ // Daemonize self if requested
|
||||||
|
+ if (F_flag == 0) {
|
||||||
|
+ daemon_pid = fork();
|
||||||
|
+ if (daemon_pid < 0) { numad_log(LOG_CRIT, "fork() failed\n"); exit(EXIT_FAILURE); }
|
||||||
|
+ // Parent process now exits
|
||||||
|
+ if (daemon_pid > 0) { exit(EXIT_SUCCESS); }
|
||||||
|
+
|
||||||
|
+ // Child process continues...
|
||||||
|
+ umask(S_IWGRP | S_IWOTH); // Reset the file mode
|
||||||
|
+ int sid = setsid(); // Start a new session
|
||||||
|
+ if (sid < 0) { numad_log(LOG_CRIT, "setsid() failed\n"); exit(EXIT_FAILURE); }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if ((chdir("/")) < 0) { numad_log(LOG_CRIT, "chdir() failed"); exit(EXIT_FAILURE); }
|
||||||
|
daemon_pid = register_numad_pid();
|
||||||
|
if (daemon_pid != getpid()) {
|
||||||
|
diff --git a/numad.service b/numad.service
|
||||||
|
index d0c8c5b..0223ca9 100644
|
||||||
|
--- a/numad.service
|
||||||
|
+++ b/numad.service
|
||||||
|
@@ -2,10 +2,9 @@
|
||||||
|
Description=numad - The NUMA daemon that manages application locality.
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
-Type=forking
|
||||||
|
-PIDFile=/var/run/numad.pid
|
||||||
|
+Type=simple
|
||||||
|
EnvironmentFile=/etc/numad.conf
|
||||||
|
-ExecStart=/usr/sbin/numad -i $INTERVAL
|
||||||
|
+ExecStart=/usr/sbin/numad -i $INTERVAL -F
|
||||||
|
ExecStop=/usr/sbin/numad -i 0
|
||||||
|
|
||||||
|
[Install]
|
32
numad-versioning.patch
Normal file
32
numad-versioning.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From c2b959b7ce05d5a6a9b486b78f2aaac7b4e874a9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mel Gorman <mgorman@suse.de>
|
||||||
|
Date: Thu, 23 May 2013 00:49:36 +0100
|
||||||
|
Subject: [PATCH] Version binary according to openSUSE guidelines
|
||||||
|
|
||||||
|
Subject says is all. rpmlint will complain about date in the name and
|
||||||
|
the binary version should match the rpm string.
|
||||||
|
|
||||||
|
Signed-off-by: Mel Gorman <mgorman@suse.de>
|
||||||
|
|
||||||
|
diff --git a/numad.c b/numad.c
|
||||||
|
index c9c86f5..d08b622 100644
|
||||||
|
--- a/numad.c
|
||||||
|
+++ b/numad.c
|
||||||
|
@@ -54,7 +54,7 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#include <values.h>
|
||||||
|
|
||||||
|
|
||||||
|
-#define VERSION_STRING "20121130"
|
||||||
|
+#define VERSION_STRING "0.5.20130522"
|
||||||
|
|
||||||
|
|
||||||
|
#define VAR_RUN_FILE "/var/run/numad.pid"
|
||||||
|
@@ -671,7 +671,7 @@ void shut_down_numad() {
|
||||||
|
|
||||||
|
|
||||||
|
void print_version_and_exit(char *prog_name) {
|
||||||
|
- fprintf(stdout, "%s version: %s: compiled %s\n", prog_name, VERSION_STRING, __DATE__);
|
||||||
|
+ fprintf(stdout, "%s version: %s\n", prog_name, VERSION_STRING);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
5
numad.changes
Normal file
5
numad.changes
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 22 23:55:17 UTC 2013 - mgorman@suse.com
|
||||||
|
|
||||||
|
- Initial package
|
||||||
|
|
119
numad.spec
Normal file
119
numad.spec
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
#
|
||||||
|
# spec file for package numad
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
Name: numad
|
||||||
|
Url: http://git.fedorahosted.org/git/numad.git
|
||||||
|
Summary: Userspace daemon that automatically binds workloads to NUMA nodes
|
||||||
|
License: LGPL-2.1
|
||||||
|
Group: System/Daemons
|
||||||
|
Version: 0.5.20130522
|
||||||
|
Release: 0
|
||||||
|
Source0: numad-%{version}.tar.bz2
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
Patch1: mainline-sysfs-paths.patch
|
||||||
|
Patch2: numad-sbindir.patch
|
||||||
|
Patch3: numad-opensuse-init.patch
|
||||||
|
Patch4: numad-versioning.patch
|
||||||
|
Patch5: numad-rpm-opt-flags.patch
|
||||||
|
Patch6: numad-opensuse-systemd.patch
|
||||||
|
Patch7: numad-systemd-simple-type.patch
|
||||||
|
|
||||||
|
%if 0%{?suse_version} > 1140
|
||||||
|
BuildRequires: systemd
|
||||||
|
%{?systemd_requires}
|
||||||
|
%define has_systemd 1
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%description
|
||||||
|
numad is a userspace daemon that monitors NUMA usage and resource usage
|
||||||
|
and attempts to configure workloads using cpusets to use a subset of
|
||||||
|
CPUs and memory nodes to maximise the number local memory access for
|
||||||
|
best performance. Alternatively, it can be used to give hints as to how
|
||||||
|
workloads should be manually bound to CPUs and memory nodes. This daemon
|
||||||
|
is primarily intended for scenarios where there are multiple processes
|
||||||
|
each which fit within a NUMA node. Examples of such configurations are
|
||||||
|
virtual machine instances where each VM is smaller than a NUMA node
|
||||||
|
or running multiple JVMs where each instance fits within a NUMA node.
|
||||||
|
If the workload is one process that spans two or more nodes such as
|
||||||
|
a large database server or a single JVM instance then numad is likely
|
||||||
|
to regress performance.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
make OPT_CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
|
||||||
|
|
||||||
|
%install
|
||||||
|
%makeinstall prefix=$RPM_BUILD_ROOT%{_prefix} install
|
||||||
|
gzip $RPM_BUILD_ROOT%{_mandir}/man8/numad.8
|
||||||
|
%{__install} -D -m 644 numad.conf $RPM_BUILD_ROOT/etc/numad.conf
|
||||||
|
%if 0%{?has_systemd}
|
||||||
|
install -D -m 0644 numad.service %{buildroot}%{_unitdir}/numad.service
|
||||||
|
ln -sf ../../usr/sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnumad
|
||||||
|
%endif
|
||||||
|
%if 0%{suse_version} < 1230
|
||||||
|
%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/init.d
|
||||||
|
%{__install} -m 744 numad.init $RPM_BUILD_ROOT%{_sysconfdir}/init.d/numad
|
||||||
|
ln -sf ../../etc/init.d/numad $RPM_BUILD_ROOT/usr/sbin/rcnumad
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{_sbindir}/numad
|
||||||
|
%{_sbindir}/rcnumad
|
||||||
|
%{_mandir}/man8/numad.8.gz
|
||||||
|
%config /etc/numad.conf
|
||||||
|
%if 0%{?has_systemd}
|
||||||
|
%{_unitdir}/numad.service
|
||||||
|
%endif
|
||||||
|
%if 0%{suse_version} < 1230
|
||||||
|
%config /etc/init.d/numad
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%pre
|
||||||
|
%if 0%{?has_systemd}
|
||||||
|
%service_add_pre numad.service
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%stop_on_removal numad
|
||||||
|
%if 0%{?has_systemd}
|
||||||
|
%service_del_preun numad.service
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%post
|
||||||
|
%if 0%{?has_systemd}
|
||||||
|
%service_add_post numad.service
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%restart_on_update numad
|
||||||
|
%insserv_cleanup
|
||||||
|
%if 0%{?has_systemd}
|
||||||
|
%service_del_postun numad.service
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%changelog
|
Loading…
Reference in New Issue
Block a user