aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
authorWanpeng Li <wanpeng.li@linux.intel.com>2014-11-25 19:44:04 -0500
committerIngo Molnar <mingo@kernel.org>2015-02-04 01:52:27 -0500
commit75381608e8410a72ae8b4080849dc86b472c01fb (patch)
tree738bd894b55dbb61c8437c1d845382b70685e5f3 /kernel/sched/core.c
parent1019a359d3dc4b64d0e1e5a5efcb725d5e83994d (diff)
sched/deadline: Avoid pointless __setscheduler()
There is no need to dequeue/enqueue and push/pull if there are no scheduling parameters changed for the DL class. Both fair and RT classes already check if parameters changed for them to avoid unnecessary overhead. This patch add the parameters changed test for the DL class in order to reduce overhead. Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com> [ Fixed up the changelog. ] Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Juri Lelli <juri.lelli@arm.com> Cc: Kirill Tkhai <ktkhai@parallels.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/1416962647-76792-5-git-send-email-wanpeng.li@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 50a5352f6205..d59652d60f86 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3417,6 +3417,20 @@ static bool check_same_owner(struct task_struct *p)
3417 return match; 3417 return match;
3418} 3418}
3419 3419
3420static bool dl_param_changed(struct task_struct *p,
3421 const struct sched_attr *attr)
3422{
3423 struct sched_dl_entity *dl_se = &p->dl;
3424
3425 if (dl_se->dl_runtime != attr->sched_runtime ||
3426 dl_se->dl_deadline != attr->sched_deadline ||
3427 dl_se->dl_period != attr->sched_period ||
3428 dl_se->flags != attr->sched_flags)
3429 return true;
3430
3431 return false;
3432}
3433
3420static int __sched_setscheduler(struct task_struct *p, 3434static int __sched_setscheduler(struct task_struct *p,
3421 const struct sched_attr *attr, 3435 const struct sched_attr *attr,
3422 bool user) 3436 bool user)
@@ -3545,7 +3559,7 @@ recheck:
3545 goto change; 3559 goto change;
3546 if (rt_policy(policy) && attr->sched_priority != p->rt_priority) 3560 if (rt_policy(policy) && attr->sched_priority != p->rt_priority)
3547 goto change; 3561 goto change;
3548 if (dl_policy(policy)) 3562 if (dl_policy(policy) && dl_param_changed(p, attr))
3549 goto change; 3563 goto change;
3550 3564
3551 p->sched_reset_on_fork = reset_on_fork; 3565 p->sched_reset_on_fork = reset_on_fork;