aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2022-03-21 10:14:05 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2022-03-23 13:36:55 +0000
commit9b8016548ef61e2c42271c7dce35d0322540d2f1 (patch)
tree055f87e60885b547eb7f5e2d0aeacd30c4965979
parent31e076d70b5fc06e9cd9ecfe19296d4fe6a8a5a5 (diff)
-rw-r--r--sys/compat/linuxkpi/common/include/linux/sched.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h
index 5bb9047640b8..aa4bdbc65c5b 100644
--- a/sys/compat/linuxkpi/common/include/linux/sched.h
+++ b/sys/compat/linuxkpi/common/include/linux/sched.h
@@ -45,6 +45,7 @@
#include <linux/pid.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/spinlock.h>
#include <linux/time.h>
#include <asm/atomic.h>
@@ -127,6 +128,18 @@ put_task_struct(struct task_struct *task)
#define need_resched() (curthread->td_flags & TDF_NEEDRESCHED)
+static inline int
+cond_resched_lock(spinlock_t *lock)
+{
+
+ if (need_resched() == 0)
+ return (0);
+ spin_lock(lock);
+ cond_resched();
+ spin_unlock(lock);
+ return (1);
+}
+
bool linux_signal_pending(struct task_struct *task);
bool linux_fatal_signal_pending(struct task_struct *task);
bool linux_signal_pending_state(long state, struct task_struct *task);