From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816AbbHMPWT (ORCPT ); Thu, 13 Aug 2015 11:22:19 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:56322 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751820AbbHMPWS (ORCPT ); Thu, 13 Aug 2015 11:22:18 -0400 Date: Thu, 13 Aug 2015 17:22:12 +0200 From: Peter Zijlstra To: Yuyang Du Cc: Byungchul Park , mingo@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched: sync with the cfs_rq when changing sched class Message-ID: <20150813152212.GE16853@twins.programming.kicks-ass.net> References: <1439445355-24137-1-git-send-email-byungchul.park@lge.com> <20150813074600.GB16853@twins.programming.kicks-ass.net> <20150813082127.GO3956@byungchulpark-X58A-UD3R> <20150813021527.GB2143@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150813021527.GB2143@intel.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 13, 2015 at 10:15:28AM +0800, Yuyang Du wrote: > On Thu, Aug 13, 2015 at 05:21:27PM +0900, Byungchul Park wrote: > > > > yuyang said that switched_to don't need to consider task's load because it > > can have meaningless value. but i think considering task's load is better > > than leaving it unattended at all. and we can also use switched_to if we > > consider task's load in switched_to. > > when did I say "don't need to consider..."? > > Doing more does not mean better, or just trivial. BTW, the task switched_to > does not have to be switched_from before. Correct, there's a few corner cases we need to consider. However, I think we unconditionally call init_entity_runnable_average() on all tasks, regardless of their 'initial' sched class, so it should have a valid state. Another thing to consider is the state being very stale, suppose it started live as FAIR, ran for a bit, got switched to !FAIR by means of sys_sched_setscheduler()/sys_sched_setattr() or similar, runs for a long time and for some reason gets switched back to FAIR, we need to age and or re-init things. I _think_ we can use last_update_time for that, but I've not looked too hard. That is, age based on last_update_time, if all 0, reinit, or somesuch. The most common case of switched_from()/switched_to() is Priority Inheritance, and that typically results in very short lived stints as !FAIR and the avg data should be still accurate by the time we return.