From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753265AbdCAQ0Q (ORCPT ); Wed, 1 Mar 2017 11:26:16 -0500 Received: from mail.kernel.org ([198.145.29.136]:50938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963AbdCAQ0N (ORCPT ); Wed, 1 Mar 2017 11:26:13 -0500 Date: Wed, 1 Mar 2017 11:19:22 -0500 From: Steven Rostedt To: Peter Zijlstra Cc: Pavan Kondeti , LKML , Ingo Molnar , Andrew Morton Subject: Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too Message-ID: <20170301111922.27700f17@gandalf.local.home> In-Reply-To: <20170301160352.GO6515@twins.programming.kicks-ass.net> References: <20170119101703.2abeaeb6@gandalf.local.home> <20170119174408.GN6485@twins.programming.kicks-ass.net> <20170223135458.GC6515@twins.programming.kicks-ass.net> <20170301105303.00773560@gandalf.local.home> <20170301160352.GO6515@twins.programming.kicks-ass.net> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Mar 2017 17:03:52 +0100 Peter Zijlstra wrote: > On Wed, Mar 01, 2017 at 10:53:03AM -0500, Steven Rostedt wrote: > > Peter, do we have a solution for this yet? Are you going to add the one > > with the linker magic? > > I queued the below earlier today. Isn't this pretty much identical to the patch I sent you a month ago? http://lkml.kernel.org/r/20170119101703.2abeaeb6@gandalf.local.home -- Steve > > --- > Subject: sched: Fix pick_next_task() for RT,DL > From: Peter Zijlstra > Date: Wed Mar 1 10:51:47 CET 2017 > > Pavan noticed that commit 49ee576809d8 ("sched/core: Optimize > pick_next_task() for idle_sched_class") broke RT,DL balancing by > robbing them of the opportinty to do new-'idle' balancing when their > last runnable task (on that runqueue) goes away. > > Cc: Steven Rostedt > Reported-by: Pavan Kondeti > Fixes: 49ee576809d8 ("sched/core: Optimize pick_next_task() for idle_sched_class") > Signed-off-by: Peter Zijlstra (Intel) > --- > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3273,10 +3273,15 @@ pick_next_task(struct rq *rq, struct tas > struct task_struct *p; > > /* > - * Optimization: we know that if all tasks are in > - * the fair class we can call that function directly: > + * Optimization: we know that if all tasks are in the fair class we can > + * call that function directly, but only if the @pref task wasn't of a > + * higher scheduling class, because otherwise those loose the > + * opportunity to pull in more work from other CPUs. > */ > - if (likely(rq->nr_running == rq->cfs.h_nr_running)) { > + if (likely((prev->sched_class == &idle_sched_class || > + prev->sched_class == &fair_sched_class) && > + rq->nr_running == rq->cfs.h_nr_running)) { > + > p = fair_sched_class.pick_next_task(rq, prev, rf); > if (unlikely(p == RETRY_TASK)) > goto again;