[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] sched: Detect KIST support at compile time
commit 8424c4f35bd77f5b83113a74c424ca6d12393f1d
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date: Thu Aug 31 09:56:55 2017 -0400
sched: Detect KIST support at compile time
Add a detection for the KIST scheduler in our build system and set
HAVE_KIST_SUPPORT if available.
Adapt the should use kist function with this new compile option.
Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
configure.ac | 28 ++++++++++++++++++++++++++++
src/or/scheduler.c | 11 -----------
src/or/scheduler.h | 2 +-
src/or/scheduler_kist.c | 23 +++++++++++++++++++++++
4 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1e41b3f08..c449294d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -792,6 +792,34 @@ AC_CHECK_MEMBERS([SSL.state], , ,
[#include <openssl/ssl.h>
])
+dnl Define the set of checks for KIST scheduler support.
+AC_DEFUN([CHECK_KIST_SUPPORT],[
+ dnl KIST needs struct tcp_info and for certain members to exist.
+ AC_CHECK_MEMBERS(
+ [struct tcp_info.tcpi_unacked, struct tcp_info.tcpi_snd_mss],
+ , ,[[#include <netinet/tcp.h>]])
+ dnl KIST needs SIOCOUTQNSD to exist for an ioctl call.
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
+ #include <linux/sockios.h>
+ #ifndef SIOCOUTQNSD
+ #error
+ #endif
+ ])], have_siocoutqnsd=yes, have_siocoutqnsd=no)
+ if test "x$have_siocoutqnsd" = "xyes"; then
+ if test "x$ac_cv_member_struct_tcp_info_tcpi_unacked" = "xyes"; then
+ if test "x$ac_cv_member_struct_tcp_info_tcpi_snd_mss" = "xyes"; then
+ have_kist_support=yes
+ fi
+ fi
+ fi
+])
+dnl Now, trigger the check.
+CHECK_KIST_SUPPORT
+AS_IF([test "x$have_kist_support" = "xyes"],
+ [AC_DEFINE(HAVE_KIST_SUPPORT, 1, [Defined if KIST scheduler is supported
+ on this system])],
+ [AC_MSG_NOTICE([KIST scheduler can't be used. Missing support.])])
+
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"
CPPFLAGS="$save_CPPFLAGS"
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index b04bdceb4..f02b70793 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -215,17 +215,6 @@ get_run_sched_ev(void)
return run_sched_ev;
}
-/* Return true iff the scheduler subsystem should use KIST. */
-int
-scheduler_should_use_kist(void)
-{
- int64_t run_freq = kist_scheduler_run_interval();
- log_info(LD_SCHED, "Determined sched_run_interval should be %" PRId64 ". "
- "Will%s use KIST.",
- run_freq, (run_freq > 0 ? "" : " not"));
- return run_freq > 0;
-}
-
/* Comparison function to use when sorting pending channels */
MOCK_IMPL(int,
scheduler_compare_channels, (const void *c1_v, const void *c2_v))
diff --git a/src/or/scheduler.h b/src/or/scheduler.h
index 3932e6049..ce5163b81 100644
--- a/src/or/scheduler.h
+++ b/src/or/scheduler.h
@@ -116,7 +116,6 @@ MOCK_DECL(void, scheduler_channel_has_waiting_cells, (channel_t *chan));
/*********************************
* Defined in scheduler.c
*********************************/
-int scheduler_should_use_kist(void);
smartlist_t *get_channels_pending(void);
struct event *get_run_sched_ev(void);
MOCK_DECL(int, scheduler_compare_channels,
@@ -156,6 +155,7 @@ MOCK_DECL(int, channel_should_write_to_kernel,
MOCK_DECL(void, channel_write_to_kernel, (channel_t *chan));
MOCK_DECL(void, update_socket_info_impl, (socket_table_ent_t *ent));
+int scheduler_should_use_kist(void);
scheduler_t *get_kist_scheduler(void);
int32_t kist_scheduler_run_interval(const networkstatus_t *ns);
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c
index 97722cb25..98b523f5a 100644
--- a/src/or/scheduler_kist.c
+++ b/src/or/scheduler_kist.c
@@ -588,3 +588,26 @@ kist_scheduler_run_interval(const networkstatus_t *ns)
return run_interval;
}
+#ifdef HAVE_KIST_SUPPORT
+
+/* Return true iff the scheduler subsystem should use KIST. */
+int
+scheduler_should_use_kist(void)
+{
+ int64_t run_interval = kist_scheduler_run_interval(NULL);
+ log_info(LD_SCHED, "Determined sched_run_interval should be %" PRId64 ". "
+ "Will%s use KIST.",
+ run_interval, (run_interval > 0 ? "" : " not"));
+ return run_interval > 0;
+}
+
+#else /* HAVE_KIST_SUPPORT */
+
+int
+scheduler_should_use_kist(void)
+{
+ return 0;
+}
+
+#endif /* HAVE_KIST_SUPPORT */
+
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits