From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756134AbbBRSo3 (ORCPT ); Wed, 18 Feb 2015 13:44:29 -0500 Received: from terminus.zytor.com ([198.137.202.10]:41886 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753928AbbBRSoG (ORCPT ); Wed, 18 Feb 2015 13:44:06 -0500 Date: Wed, 18 Feb 2015 10:43:30 -0800 From: tip-bot for Rik van Riel Message-ID: Cc: rostedt@goodmis.org, hpa@zytor.com, peterz@infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, lcapitulino@redhat.com, riel@redhat.com, mingo@kernel.org Reply-To: linux-kernel@vger.kernel.org, peterz@infradead.org, rostedt@goodmis.org, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, riel@redhat.com, lcapitulino@redhat.com In-Reply-To: <20150216152349.6a8ed824@annuminas.surriel.com> References: <20150216152349.6a8ed824@annuminas.surriel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/rt/nohz: Stop scheduler tick if running realtime task Git-Commit-ID: 1e78cdbd9b2266503339accafe0ebdd99b93a531 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: 1e78cdbd9b2266503339accafe0ebdd99b93a531 Gitweb: http://git.kernel.org/tip/1e78cdbd9b2266503339accafe0ebdd99b93a531 Author: Rik van Riel AuthorDate: Mon, 16 Feb 2015 15:23:49 -0500 Committer: Ingo Molnar CommitDate: Wed, 18 Feb 2015 18:21:19 +0100 sched/rt/nohz: Stop scheduler tick if running realtime task If the CPU is running a realtime task that does not round-robin with another realtime task of equal priority, there is no point in keeping the scheduler tick going. After all, whenever the scheduler tick runs, the kernel will just decide not to reschedule. Extend sched_can_stop_tick() to recognize these situations, and inform the rest of the kernel that the scheduler tick can be stopped. Tested-by: Luiz Capitulino Signed-off-by: Rik van Riel Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Thomas Gleixner Cc: fweisbec@redhat.com Cc: mtosatti@redhat.com Link: http://lkml.kernel.org/r/20150216152349.6a8ed824@annuminas.surriel.com [ Small cleanliness tweak. ] Signed-off-by: Ingo Molnar --- kernel/sched/core.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a4869bd..97fe79c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -690,6 +690,23 @@ static inline bool got_nohz_idle_kick(void) bool sched_can_stop_tick(void) { /* + * FIFO realtime policy runs the highest priority task. Other runnable + * tasks are of a lower priority. The scheduler tick does nothing. + */ + if (current->policy == SCHED_FIFO) + return true; + + /* + * Round-robin realtime tasks time slice with other tasks at the same + * realtime priority. Is this task the only one at this priority? + */ + if (current->policy == SCHED_RR) { + struct sched_rt_entity *rt_se = ¤t->rt; + + return rt_se->run_list.prev == rt_se->run_list.next; + } + + /* * More than one running task need preemption. * nr_running update is assumed to be visible * after IPI is sent from wakers.