mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-24 05:01:03 +02:00
preempt/dynamic: Provide cond_resched() and might_resched() static calls
Provide static calls to control cond_resched() (called in !CONFIG_PREEMPT) and might_resched() (called in CONFIG_PREEMPT_VOLUNTARY) to that we can override their behaviour when preempt= is overriden. Since the default behaviour is full preemption, both their calls are ignored when preempt= isn't passed. [fweisbec: branch might_resched() directly to __cond_resched(), only define static calls when PREEMPT_DYNAMIC] Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lkml.kernel.org/r/20210118141223.123667-6-frederic@kernel.org
This commit is contained in:
committed by
Ingo Molnar
parent
6ef869e064
commit
b965f1ddb4
@@ -15,7 +15,7 @@
|
||||
#include <linux/typecheck.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/build_bug.h>
|
||||
|
||||
#include <linux/static_call_types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#include <uapi/linux/kernel.h>
|
||||
@@ -81,11 +81,26 @@ struct pt_regs;
|
||||
struct user;
|
||||
|
||||
#ifdef CONFIG_PREEMPT_VOLUNTARY
|
||||
extern int _cond_resched(void);
|
||||
# define might_resched() _cond_resched()
|
||||
|
||||
extern int __cond_resched(void);
|
||||
# define might_resched() __cond_resched()
|
||||
|
||||
#elif defined(CONFIG_PREEMPT_DYNAMIC)
|
||||
|
||||
extern int __cond_resched(void);
|
||||
|
||||
DECLARE_STATIC_CALL(might_resched, __cond_resched);
|
||||
|
||||
static __always_inline void might_resched(void)
|
||||
{
|
||||
static_call(might_resched)();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# define might_resched() do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_PREEMPT_* */
|
||||
|
||||
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
|
||||
extern void ___might_sleep(const char *file, int line, int preempt_offset);
|
||||
|
Reference in New Issue
Block a user