linux/debian/patches/features/all/rt/sched-no-work-when-pi-block...

59 lines
1.7 KiB
Diff

Subject: sched-no-work-when-pi-blocked.patch
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 17 Jul 2011 20:46:52 +0200
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/sched.h | 8 ++++++++
kernel/sched.c | 5 ++++-
2 files changed, 12 insertions(+), 1 deletion(-)
Index: linux-3.2/include/linux/sched.h
===================================================================
--- linux-3.2.orig/include/linux/sched.h
+++ linux-3.2/include/linux/sched.h
@@ -2092,12 +2092,20 @@ extern unsigned int sysctl_sched_cfs_ban
extern int rt_mutex_getprio(struct task_struct *p);
extern void rt_mutex_setprio(struct task_struct *p, int prio);
extern void rt_mutex_adjust_pi(struct task_struct *p);
+static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
+{
+ return tsk->pi_blocked_on != NULL;
+}
#else
static inline int rt_mutex_getprio(struct task_struct *p)
{
return p->normal_prio;
}
# define rt_mutex_adjust_pi(p) do { } while (0)
+static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
+{
+ return false;
+}
#endif
extern bool yield_to(struct task_struct *p, bool preempt);
Index: linux-3.2/kernel/sched.c
===================================================================
--- linux-3.2.orig/kernel/sched.c
+++ linux-3.2/kernel/sched.c
@@ -4461,7 +4461,7 @@ need_resched:
static inline void sched_submit_work(struct task_struct *tsk)
{
- if (!tsk->state)
+ if (!tsk->state || tsk_is_pi_blocked(tsk))
return;
/*
@@ -4481,6 +4481,9 @@ static inline void sched_submit_work(str
static inline void sched_update_worker(struct task_struct *tsk)
{
+ if (tsk_is_pi_blocked(tsk))
+ return;
+
if (tsk->flags & PF_WQ_WORKER)
wq_worker_running(tsk);
}