[PATCH] worker_cpu_affinity support for DragonFlyBSD
Maxim Dounin
mdounin at mdounin.ru
Fri May 26 16:04:01 UTC 2017
Hello!
On Fri, May 26, 2017 at 02:56:06PM +0800, Sepherosa Ziehau wrote:
> Hi all,
>
> The patch is here:
> https://leaf.dragonflybsd.org/~sephe/nginx_dfly_affinity.diff
>
> Unlike FreeBSD, we adopted sched_setaffinity() syscall for process CPU affinity.
A better solution might be to move sched_setaffinity() test from
auto/os/linux to auto/unix instead. Patch below (untested).
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1495814031 -10800
# Fri May 26 18:53:51 2017 +0300
# Node ID d4d316c4503f7b9bbf47b0006822e4438e6e641a
# Parent 9552758a786e20c70130427298895bc782a754c5
Configure: sched_setaffinity() test moved to auto/unix.
The sched_setaffinity() function was introduced in DragonFly BSD 4.7,
so it is no longer Linux-specific.
diff --git a/auto/os/linux b/auto/os/linux
--- a/auto/os/linux
+++ b/auto/os/linux
@@ -157,20 +157,6 @@ ngx_feature_test="if (prctl(PR_SET_DUMPA
. auto/feature
-# sched_setaffinity()
-
-ngx_feature="sched_setaffinity()"
-ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY"
-ngx_feature_run=no
-ngx_feature_incs="#include <sched.h>"
-ngx_feature_path=
-ngx_feature_libs=
-ngx_feature_test="cpu_set_t mask;
- CPU_ZERO(&mask);
- sched_setaffinity(0, sizeof(cpu_set_t), &mask)"
-. auto/feature
-
-
# crypt_r()
ngx_feature="crypt_r()"
diff --git a/auto/unix b/auto/unix
--- a/auto/unix
+++ b/auto/unix
@@ -300,6 +300,18 @@ if [ $ngx_found = no ]; then
fi
+ngx_feature="sched_setaffinity()"
+ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY"
+ngx_feature_run=no
+ngx_feature_incs="#include <sched.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="cpu_set_t mask;
+ CPU_ZERO(&mask);
+ sched_setaffinity(0, sizeof(cpu_set_t), &mask)"
+. auto/feature
+
+
ngx_feature="SO_SETFIB"
ngx_feature_name="NGX_HAVE_SETFIB"
ngx_feature_run=no
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list