Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758142Ab3FULJ2 (ORCPT ); Fri, 21 Jun 2013 07:09:28 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:48865 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138Ab3FULJ1 (ORCPT ); Fri, 21 Jun 2013 07:09:27 -0400 Message-ID: <51C4345E.1010604@gmail.com> Date: Fri, 21 Jun 2013 19:09:18 +0800 From: Alex Shi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Lei Wen CC: Paul Turner , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Andrew Morton , Borislav Petkov , Namhyung Kim , Mike Galbraith , Morten Rasmussen , Vincent Guittot , Preeti U Murthy , Viresh Kumar , LKML , Mel Gorman , Rik van Riel , Michael Wang , Jason Low , Changlong Xie , sgruszka@redhat.com, =?ISO-8859-1?Q?Fr=E9d=E9ric_Weisbecker?= Subject: Re: [patch v8 4/9] sched: fix slept time double counting in enqueue entity References: <1370589652-24549-1-git-send-email-alex.shi@intel.com> <1370589652-24549-5-git-send-email-alex.shi@intel.com> <51BF2E37.5040400@intel.com> <51C318D6.4090601@gmail.com> <51C3BCE1.1080405@gmail.com> <51C4152E.60906@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1991 Lines: 59 >>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >>> index c61a614..9640c66 100644 >>> --- a/kernel/sched/fair.c >>> +++ b/kernel/sched/fair.c >>> @@ -5856,7 +5856,8 @@ static void switched_from_fair(struct rq *rq, >>> struct task_struct *p) >>> */ >>> if (p->se.avg.decay_count) { >>> struct cfs_rq *cfs_rq = cfs_rq_of(&p->se); >>> - __synchronize_entity_decay(&p->se); >>> + p->se.avg.last_runnable_update += >>> + __synchronize_entity_decay(&p->se); >> >> it is not needed, since the last_runnable_update will be reset if it >> will be switched to fair. > > When it is backed to fair class, the only thing scheduler would do > is to check whether it could preempt current running task, so > where to reset the last_runnable_update? here, when the task enqueue to cfs_rq. avg.decay_count == 0, so the last line will reset last_runnable_update. Anyway, you may consider to add a comment in the function, since it is bit hard to understand for you. --- /* Add the load generated by se into cfs_rq's child load-average */ static inline void enqueue_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup) { /* * We track migrations using entity decay_count <= 0, on a wake-up * migration we use a negative decay count to track the remote decays * accumulated while sleeping. */ if (unlikely(se->avg.decay_count <= 0)) { se->avg.last_runnable_update = rq_of(cfs_rq)->clock_task; > > Thanks, > Lei > >> >> -- >> Thanks >> Alex -- Thanks Alex -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/