From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751279AbdBWPPU (ORCPT ); Thu, 23 Feb 2017 10:15:20 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:60946 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049AbdBWPPS (ORCPT ); Thu, 23 Feb 2017 10:15:18 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6F54060A51 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pkondeti@codeaurora.org MIME-Version: 1.0 In-Reply-To: <20170223135458.GC6515@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> From: Pavan Kondeti Date: Thu, 23 Feb 2017 20:45:06 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] sched: Optimize pick_next_task for idle_sched_class too To: Peter Zijlstra Cc: Pavan Kondeti , Steven Rostedt , LKML , Ingo Molnar , Andrew Morton Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Thu, Feb 23, 2017 at 7:24 PM, Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 04:04:22PM +0530, Pavan Kondeti wrote: >> Hi Peter, >> >> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> > index 49ce1cb..51ca21e 100644 >> > --- a/kernel/sched/core.c >> > +++ b/kernel/sched/core.c >> > @@ -3321,15 +3321,14 @@ static inline void schedule_debug(struct task_struct *prev) >> > static inline struct task_struct * >> > pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) >> > { >> > - const struct sched_class *class = &fair_sched_class; >> > + const struct sched_class *class; >> > struct task_struct *p; >> > >> > /* >> > * Optimization: we know that if all tasks are in >> > * the fair class we can call that function directly: >> > */ >> > - if (likely(prev->sched_class == class && >> > - rq->nr_running == rq->cfs.h_nr_running)) { >> > + if (likely(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; >> >> Would this delay pulling RT tasks from other CPUs? Lets say this CPU >> has 2 fair tasks and 1 RT task. The RT task is sleeping now. Earlier, >> we attempt to pull RT tasks from other CPUs in pick_next_task_rt(), >> which is not done anymore. > > It should not; the two places of interrests are when we leave the RT > class to run anything lower (fair,idle), at which point we'll pull, > or when an RT tasks wakes up, at which point it'll push. Can you kindly show me where we are pulling when a RT task goes to sleep? Apart from class/prio change, I see pull happening only from pick_next_task_rt(). Thanks, Pavan -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project