From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755633AbbBDOgT (ORCPT ); Wed, 4 Feb 2015 09:36:19 -0500 Received: from terminus.zytor.com ([198.137.202.10]:38726 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755127AbbBDOgP (ORCPT ); Wed, 4 Feb 2015 09:36:15 -0500 Date: Wed, 4 Feb 2015 06:35:33 -0800 From: tip-bot for Wanpeng Li Message-ID: Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, ktkhai@parallels.com, torvalds@linux-foundation.org, wanpeng.li@linux.intel.com, peterz@infradead.org, juri.lelli@arm.com, tglx@linutronix.de, hpa@zytor.com Reply-To: hpa@zytor.com, tglx@linutronix.de, juri.lelli@arm.com, wanpeng.li@linux.intel.com, peterz@infradead.org, ktkhai@parallels.com, torvalds@linux-foundation.org, mingo@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <1416962647-76792-5-git-send-email-wanpeng.li@linux.intel.com> References: <1416962647-76792-5-git-send-email-wanpeng.li@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/deadline: Avoid pointless __setscheduler() Git-Commit-ID: 75381608e8410a72ae8b4080849dc86b472c01fb X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 75381608e8410a72ae8b4080849dc86b472c01fb Gitweb: http://git.kernel.org/tip/75381608e8410a72ae8b4080849dc86b472c01fb Author: Wanpeng Li AuthorDate: Wed, 26 Nov 2014 08:44:04 +0800 Committer: Ingo Molnar CommitDate: Wed, 4 Feb 2015 07:52:27 +0100 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 [ Fixed up the changelog. ] Signed-off-by: Peter Zijlstra (Intel) Cc: Juri Lelli Cc: Kirill Tkhai Cc: Linus Torvalds Link: http://lkml.kernel.org/r/1416962647-76792-5-git-send-email-wanpeng.li@linux.intel.com Signed-off-by: Ingo Molnar --- kernel/sched/core.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 50a5352..d59652d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3417,6 +3417,20 @@ static bool check_same_owner(struct task_struct *p) return match; } +static bool dl_param_changed(struct task_struct *p, + const struct sched_attr *attr) +{ + struct sched_dl_entity *dl_se = &p->dl; + + if (dl_se->dl_runtime != attr->sched_runtime || + dl_se->dl_deadline != attr->sched_deadline || + dl_se->dl_period != attr->sched_period || + dl_se->flags != attr->sched_flags) + return true; + + return false; +} + static int __sched_setscheduler(struct task_struct *p, const struct sched_attr *attr, bool user) @@ -3545,7 +3559,7 @@ recheck: goto change; if (rt_policy(policy) && attr->sched_priority != p->rt_priority) goto change; - if (dl_policy(policy)) + if (dl_policy(policy) && dl_param_changed(p, attr)) goto change; p->sched_reset_on_fork = reset_on_fork;