diff --git a/include/linux/sched.h b/include/linux/sched.h index 67623ffd4a8e..eab173e5d09b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1905,6 +1905,7 @@ static inline int dl_task_check_affinity(struct task_struct *p, const struct cpu } #endif +extern bool task_is_pi_boosted(const struct task_struct *p); extern int yield_to(struct task_struct *p, bool preempt); extern void set_user_nice(struct task_struct *p, long nice); extern int task_prio(const struct task_struct *p); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 58d0346d1bb3..aa44de0038f1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8922,6 +8922,21 @@ static inline void preempt_dynamic_init(void) { } #endif /* #ifdef CONFIG_PREEMPT_DYNAMIC */ +/* + * task_is_pi_boosted - Check if task has been PI boosted. + * @p: Task to check. + * + * Return true if task is subject to priority inheritance. + */ +bool task_is_pi_boosted(const struct task_struct *p) +{ + int prio = p->prio; + + if (!rt_prio(prio)) + return false; + return prio != p->normal_prio; +} + /** * yield - yield the current processor to other threads. *