call_rcu_after_fork_parent() after the fork(). The child
process must invoke call_rcu_after_fork_child().
These three APIs are suitable for passing to pthread_atfork().
+
+Thread Local Storage (TLS)
+
+ Userspace RCU can fall back on pthread_getspecific() to emulate
+ TLS variables on systems where it is not available. This behavior
+ can be forced by specifying --disable-compiler-tls as configure
+ argument.
for ax_tls_keyword in $ax_tls_keywords; do
AS_CASE([$ax_tls_keyword],
[none], [ac_cv_tls=none ; break],
- [AC_TRY_COMPILE(
- [#include <stdlib.h>
- static void
- foo(void) {
- static ] $ax_tls_keyword [ int bar;
- exit(1);
- }],
- [],
+ [AC_TRY_LINK(
+ [$ax_tls_keyword int foo;],
+ [++foo;],
[ac_cv_tls=$ax_tls_keyword ; break],
- ac_cv_tls=none
+ [ac_cv_tls=none]
)])
done
])
AH_TEMPLATE([CONFIG_RCU_ARM_HAVE_DMB], [Use the dmb instruction if available for use on ARM.])
AH_TEMPLATE([CONFIG_RCU_TLS], [TLS provided by the compiler.])
-AX_TLS(AC_DEFINE_UNQUOTED([CONFIG_RCU_TLS], $ac_cv_tls), [:])
+# Allow overriding storage used for TLS variables.
+AC_ARG_ENABLE([compiler-tls],
+ AS_HELP_STRING([--disable-compiler-tls], [Use pthread_getspecific() to emulate Thread Local Storage (TLS) variables.]),
+ [def_compiler_tls=$enableval],
+ [def_compiler_tls="yes"])
+
+# If not overridden, use ax_tls.m4 to check if TLS is available.
+AS_IF([test "x$def_compiler_tls" = "xyes"],
+ [AX_TLS([def_tls_detect=$ac_cv_tls], [:])],
+ [:])
+
+AS_IF([test "x$def_tls_detect" = "x"],
+ [:],
+ [AC_DEFINE_UNQUOTED([CONFIG_RCU_TLS], $def_tls_detect)])
# Checks for programs.
AC_PROG_CC
],[
AS_ECHO("SMP support disabled.")
])
+
+AS_IF([test "x$def_tls_detect" = "x"],[
+ AS_ECHO("Thread Local Storage (TLS): pthread_getspecific().")
+],[
+ AS_ECHO("Thread Local Storage (TLS): $def_tls_detect.")
+])