LKML <[email protected]>, Peter Ziljstra <[email protected]>, Henrik Austad <[email protected]>
Subject: [PATCH 2/2] sched: Let sched_class handle effective_prio calculation
Date: Mon, 20 Apr 2009 15:55:53 +0200
Message-Id: <[email protected]>
X-Mailer: git-send-email 1.6.1.2
In-Reply-To: <[email protected]>
References: <[email protected]>
Instead of testing for sched_class in the core scheduler, the calculation of the class-specific effective priority should be handled by the scheduling class.
Signed-off-by Henrik Austad <[email protected]>
Acked-by Peter Zijlstra <[email protected]>
--- include/linux/sched.h | 1 + kernel/sched.c | 11 +++-------- kernel/sched_fair.c | 1 + kernel/sched_idletask.c | 1 + kernel/sched_rt.c | 6 ++++++ 5 files changed, 12 insertions(+), 8 deletions(-)
include/linux/sched.h +1 -0
@@ -1019,6 +1019,7 @@ struct sched_class {void (*prio_changed) (struct rq *this_rq,struct task_struct *task,int oldprio,int running);int (*normal_prio) (struct task_struct *task); +int (*effective_prio) (struct task_struct *task);#ifdef CONFIG_FAIR_GROUP_SCHED void (*moved_group) (struct task_struct *p);
kernel/sched.c +3 -8
@@ -1826,15 +1826,10 @@ static inline int normal_prio(struct task_struct *p)*/ static int effective_prio (struct task_struct *p) { +/* update normal prio */ p->normal_prio =normal_prio (p); -/* -* If we are RT tasks or we were boosted to RT priority, -* keep the priority unchanged. Otherwise, update priority -* to the normal priority: -*/ -if (!rt_prio (p->prio)) -return p->normal_prio; -return p->prio; + +return p->sched_class->effective_prio (p); }/*
kernel/sched_fair.c +1 -0
@@ -1822,6 +1822,7 @@ static const struct sched_class fair_sched_class = { .prio_changed = prio_changed_fair, .normal_prio = normal_prio_fair, + .effective_prio = normal_prio_fair, .switched_to = switched_to_fair,#ifdef CONFIG_FAIR_GROUP_SCHED
kernel/sched_idletask.c +1 -0
@@ -128,6 +128,7 @@ static const struct sched_class idle_sched_class = { .prio_changed = prio_changed_idle, .normal_prio = normal_prio_idle, + .effective_prio = normal_prio_idle, .switched_to = switched_to_idle,/* no .task_new for idle tasks */
kernel/sched_rt.c +6 -0
@@ -1669,6 +1669,11 @@ static int normal_prio_rt(struct task_struct *p)return MAX_RT_PRIO -1 - p->rt_priority; } +static int effective_prio_rt (struct task_struct *p) +{ +return p->prio; +} +static void watchdog (struct rq *rq,struct task_struct *p) {unsigned long soft, hard;
@@ -1758,6 +1763,7 @@ static const struct sched_class rt_sched_class = { .prio_changed = prio_changed_rt, .normal_prio = normal_prio_rt, + .effective_prio = effective_prio_rt, .switched_to = switched_to_rt, };
Signature · 1 line
1.6.1.2