linuxkpi: Add cond_resched_lock
If we need to resched it takes the lock, resched, release the lock and returns 1, otherwise simply returns 0. Needed by drm v5.9 MFC after: 1 month Reviewed by: hselasky Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D34620
This commit is contained in:
parent
31e076d70b
commit
9b8016548e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user