MEDIUM: global: add support for CPU binding on Linux ("cpu-map")
The new "cpu-map" directive allows one to assign the CPU sets that
a process is allowed to bind to. This is useful in combination with
the "nbproc" and "bind-process" directives.
The support is implicit on Linux 2.6.28 and above.
diff --git a/Makefile b/Makefile
index f13848c..9c7a75f 100644
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,7 @@
# USE_ACCEPT4 : enable use of accept4() on linux. Automatic.
# USE_MY_ACCEPT4 : use own implemention of accept4() if glibc < 2.10.
# USE_ZLIB : enable zlib library support.
+# USE_CPU_AFFINITY : enable pinning processes to CPU on Linux. Automatic.
#
# Options can be forced by specifying "USE_xxx=1" or can be disabled by using
# "USE_xxx=" (empty string).
@@ -241,6 +242,7 @@
USE_LINUX_TPROXY= implicit
USE_ACCEPT4 = implicit
USE_FUTEX = implicit
+ USE_CPU_AFFINITY= implicit
else
ifeq ($(TARGET),solaris)
# This is for Solaris 8
@@ -437,6 +439,11 @@
BUILD_OPTIONS += $(call ignore_implicit,USE_VSYSCALL)
endif
+ifneq ($(USE_CPU_AFFINITY),)
+OPTIONS_CFLAGS += -DUSE_CPU_AFFINITY
+BUILD_OPTIONS += $(call ignore_implicit,USE_CPU_AFFINITY)
+endif
+
ifneq ($(USE_MY_SPLICE),)
OPTIONS_CFLAGS += -DUSE_MY_SPLICE
BUILD_OPTIONS += $(call ignore_implicit,USE_MY_SPLICE)