diff options
| author | Emmanuel Vadot <manu@FreeBSD.org> | 2022-03-21 10:14:05 +0000 |
|---|---|---|
| committer | Emmanuel Vadot <manu@FreeBSD.org> | 2022-03-23 13:36:55 +0000 |
| commit | 9b8016548ef61e2c42271c7dce35d0322540d2f1 (patch) | |
| tree | 055f87e60885b547eb7f5e2d0aeacd30c4965979 /sys/compat/linuxkpi/common/include | |
| parent | 31e076d70b5fc06e9cd9ecfe19296d4fe6a8a5a5 (diff) | |
Diffstat (limited to 'sys/compat/linuxkpi/common/include')
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/sched.h | 13 |
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); |
