]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
configure.ac: Add cond_resched_rcu() checks
authorSerhey Popovych <serhe.popovych@gmail.com>
Fri, 29 Nov 2019 09:21:28 +0000 (11:21 +0200)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Mon, 9 Dec 2019 10:01:14 +0000 (11:01 +0100)
It was introduced with commit f6f3c437d09e ("sched: add cond_resched_rcu()
helper") since v3.11 upstream kernel.

To support building on older kernels add implementation to ip_set_compat.h.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
configure.ac
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in

index e0025df9a014e1c3514ab7f179e70a7cbcde2597..ced28805a227c926d7a361d0c2f8fb3d471fa2f8 100644 (file)
@@ -333,6 +333,16 @@ else
        AC_SUBST(HAVE_IPV6_SKIP_EXTHDR_ARGS, 3)
 fi
 
+AC_MSG_CHECKING([kernel source for cond_resched_rcu])
+if test -f $ksourcedir/include/linux/sched.h && \
+   $AWK '/( |\t)cond_resched_rcu\(/,/\)/' $ksourcedir/include/linux/sched.h | $GREP -q 'cond_resched_rcu'; then
+       AC_MSG_RESULT(yes)
+       AC_SUBST(HAVE_COND_RESCHED_RCU, define)
+else
+       AC_MSG_RESULT(no)
+       AC_SUBST(HAVE_COND_RESCHED_RCU, undef)
+fi
+
 AC_MSG_CHECKING([kernel source for bool checkentry function prototype])
 if test -f $ksourcedir/include/linux/netfilter/x_tables.h && \
    $GREP -q 'bool .\*checkentry.' $ksourcedir/include/linux/netfilter/x_tables.h; then
index 5f12ad82b0acaaffddfabc487ab260f8d6a2c465..f4d7acc79bad04d62e8e9bc824564e0364c42780 100644 (file)
@@ -50,6 +50,7 @@
 #@HAVE_STRSCPY@ HAVE_STRSCPY
 #@HAVE_SYNCHRONIZE_RCU_BH@ HAVE_SYNCHRONIZE_RCU_BH
 #@HAVE_LOCKDEP_NFNL_IS_HELD@ HAVE_LOCKDEP_NFNL_IS_HELD
+#@HAVE_COND_RESCHED_RCU@ HAVE_COND_RESCHED_RCU
 
 #ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
 #include <linux/module.h>
@@ -148,6 +149,17 @@ do {                               \
 #endif
 #endif
 
+#ifndef HAVE_COND_RESCHED_RCU
+static inline void cond_resched_rcu(void)
+{
+#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
+       rcu_read_unlock();
+       cond_resched();
+       rcu_read_lock();
+#endif
+}
+#endif
+
 #if defined(CONFIG_NETFILTER_NETLINK) || defined(CONFIG_NETFILTER_NETLINK_MODULE)
 #else
 #error "NETFILTER_NETLINK must be enabled: select NFACCT/NFQUEUE/LOG over NFNETLINK"