From f38201c2a144fb28978eabb32a3a080874f92775 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Sun, 11 Aug 2024 16:46:05 +0100 Subject: auto: Add a check for Linux's sched_getaffinity(2) This will help to better determine the number of router threads to create in certain situations. Unlike sysconf(_SC_NPROCESSORS_ONLN) this takes into account per-process cpu allowed masks as set by sched_setaffinity(2)/cpusets etc. So while a system may have 64 on-line cpu's, Unit itself may be limited to using just four of them in which case we should create four extra router threads, not sixty-four! Signed-off-by: Andrew Clayton --- auto/sched | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 auto/sched (limited to 'auto/sched') diff --git a/auto/sched b/auto/sched new file mode 100644 index 00000000..a6a4499b --- /dev/null +++ b/auto/sched @@ -0,0 +1,19 @@ +# Copyright (C) Andrew Clayton +# Copyright (C) NGINX, Inc. + + +nxt_feature="Linux sched_getaffinity()" +nxt_feature_name=NXT_HAVE_LINUX_SCHED_GETAFFINITY +nxt_feature_run=no +nxt_feature_incs= +nxt_feature_libs= +nxt_feature_test="#define _GNU_SOURCE + #include + + int main(void) { + cpu_set_t set; + + sched_getaffinity(0, sizeof(set), &set); + return 0; + }" +. auto/feature -- cgit