From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:37125 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbcCAIQL (ORCPT ); Tue, 1 Mar 2016 03:16:11 -0500 Received: from pmta03.dal05.mailchimp.com (127.0.0.1) by mail333.us4.mandrillapp.com id hql7sm174nou for ; Tue, 1 Mar 2016 08:15:54 +0000 (envelope-from ) From: Subject: Patch "sched, rt: Convert switched_{from, to}_rt() / prio_changed_rt() to balance callbacks" has been added to the 3.14-stable tree To: , , , Cc: , Message-Id: <145681524620133@kroah.com> Date: Tue, 01 Mar 2016 08:15:54 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled sched, rt: Convert switched_{from, to}_rt() / prio_changed_rt() to balance callbacks to the 3.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sched-rt-convert-switched_-from-to-_rt-prio_changed_rt-to-balance-callbacks.patch and it can be found in the queue-3.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From fd7a4bed183523275279c9addbf42fce550c2e90 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Thu, 11 Jun 2015 14:46:41 +0200 Subject: sched, rt: Convert switched_{from, to}_rt() / prio_changed_rt() to balance callbacks From: Peter Zijlstra commit fd7a4bed183523275279c9addbf42fce550c2e90 upstream. Remove the direct {push,pull} balancing operations from switched_{from,to}_rt() / prio_changed_rt() and use the balance callback queue. Again, err on the side of too many reschedules; since too few is a hard bug while too many is just annoying. Signed-off-by: Peter Zijlstra (Intel) Cc: ktkhai@parallels.com Cc: rostedt@goodmis.org Cc: juri.lelli@gmail.com Cc: pang.xunlei@linaro.org Cc: oleg@redhat.com Cc: wanpeng.li@linux.intel.com Cc: umgwanakikbuti@gmail.com Link: http://lkml.kernel.org/r/20150611124742.766832367@infradead.org Signed-off-by: Thomas Gleixner Signed-off-by: Byungchul Park Signed-off-by: Greg Kroah-Hartman --- kernel/sched/rt.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -315,16 +315,23 @@ static inline int has_pushable_tasks(str return !plist_head_empty(&rq->rt.pushable_tasks); } -static DEFINE_PER_CPU(struct callback_head, rt_balance_head); +static DEFINE_PER_CPU(struct callback_head, rt_push_head); +static DEFINE_PER_CPU(struct callback_head, rt_pull_head); static void push_rt_tasks(struct rq *); +static void pull_rt_task(struct rq *); static inline void queue_push_tasks(struct rq *rq) { if (!has_pushable_tasks(rq)) return; - queue_balance_callback(rq, &per_cpu(rt_balance_head, rq->cpu), push_rt_tasks); + queue_balance_callback(rq, &per_cpu(rt_push_head, rq->cpu), push_rt_tasks); +} + +static inline void queue_pull_task(struct rq *rq) +{ + queue_balance_callback(rq, &per_cpu(rt_pull_head, rq->cpu), pull_rt_task); } static void enqueue_pushable_task(struct rq *rq, struct task_struct *p) @@ -1837,7 +1844,7 @@ static void switched_from_rt(struct rq * if (!p->on_rq || rq->rt.rt_nr_running) return; - pull_rt_task(rq); + queue_pull_task(rq); } void init_sched_rt_class(void) @@ -1858,8 +1865,6 @@ void init_sched_rt_class(void) */ static void switched_to_rt(struct rq *rq, struct task_struct *p) { - int check_resched = 1; - /* * If we are already running, then there's nothing * that needs to be done. But if we are not running @@ -1869,13 +1874,12 @@ static void switched_to_rt(struct rq *rq */ if (p->on_rq && rq->curr != p) { #ifdef CONFIG_SMP - if (rq->rt.overloaded && push_rt_task(rq) && - /* Don't resched if we changed runqueues */ - rq != task_rq(p)) - check_resched = 0; -#endif /* CONFIG_SMP */ - if (check_resched && p->prio < rq->curr->prio) + if (rq->rt.overloaded) + queue_push_tasks(rq); +#else + if (p->prio < rq->curr->prio) resched_task(rq->curr); +#endif /* CONFIG_SMP */ } } @@ -1896,14 +1900,13 @@ prio_changed_rt(struct rq *rq, struct ta * may need to pull tasks to this runqueue. */ if (oldprio < p->prio) - pull_rt_task(rq); + queue_pull_task(rq); + /* * If there's a higher priority task waiting to run - * then reschedule. Note, the above pull_rt_task - * can release the rq lock and p could migrate. - * Only reschedule if p is still on the same runqueue. + * then reschedule. */ - if (p->prio > rq->rt.highest_prio.curr && rq->curr == p) + if (p->prio > rq->rt.highest_prio.curr) resched_task(p); #else /* For UP simply resched on drop of prio */ Patches currently in stable-queue which might be from peterz@infradead.org are queue-3.14/sched-rt-remove-return-value-from-pull_rt_task.patch queue-3.14/sched-replace-post_schedule-with-a-balance-callback-list.patch queue-3.14/sched-clean-up-idle-task-smp-logic.patch queue-3.14/sched-dl-convert-switched_-from-to-_dl-prio_changed_dl-to-balance-callbacks.patch queue-3.14/sched-dl-remove-return-value-from-pull_dl_task.patch queue-3.14/sched-allow-balance-callbacks-for-check_class_changed.patch queue-3.14/sched-rt-convert-switched_-from-to-_rt-prio_changed_rt-to-balance-callbacks.patch