Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5491ea7 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar
Browse files

sched/rt: Add schedule_preempt_disabled()



Add helper to get rid of the ever repeating:

    preempt_enable_no_resched();
    schedule();
    preempt_disable();

patterns.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-wxx7btox7coby6ifv5vzhzgp@git.kernel.org


Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7abc63b1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -361,6 +361,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout);
extern signed long schedule_timeout_killable(signed long timeout);
extern signed long schedule_timeout_uninterruptible(signed long timeout);
asmlinkage void schedule(void);
extern void schedule_preempt_disabled(void);
extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);

struct nsproxy;
+12 −0
Original line number Diff line number Diff line
@@ -3246,6 +3246,18 @@ asmlinkage void __sched schedule(void)
}
EXPORT_SYMBOL(schedule);

/**
 * schedule_preempt_disabled - called with preemption disabled
 *
 * Returns with preemption disabled. Note: preempt_count must be 1
 */
void __sched schedule_preempt_disabled(void)
{
	preempt_enable_no_resched();
	schedule();
	preempt_disable();
}

#ifdef CONFIG_MUTEX_SPIN_ON_OWNER

static inline bool owner_running(struct mutex *lock, struct task_struct *owner)