From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754316AbcFTJwf (ORCPT ); Mon, 20 Jun 2016 05:52:35 -0400 Received: from merlin.infradead.org ([205.233.59.134]:43019 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753881AbcFTJwY (ORCPT ); Mon, 20 Jun 2016 05:52:24 -0400 Date: Mon, 20 Jun 2016 11:52:14 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: Yuyang Du , Ingo Molnar , linux-kernel , Mike Galbraith , Benjamin Segall , Paul Turner , Morten Rasmussen , Dietmar Eggemann , Matt Fleming Subject: Re: [PATCH 4/4] sched,fair: Fix PELT integrity for new tasks Message-ID: <20160620095214.GF30154@twins.programming.kicks-ass.net> References: <20160617120136.064100812@infradead.org> <20160617120454.150630859@infradead.org> <20160617142814.GT30154@twins.programming.kicks-ass.net> <20160617160239.GL30927@twins.programming.kicks-ass.net> <20160617161831.GM30927@twins.programming.kicks-ass.net> <20160620092339.GA4526@vingu-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160620092339.GA4526@vingu-laptop> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 20, 2016 at 11:23:39AM +0200, Vincent Guittot wrote: > > @@ -738,7 +739,20 @@ void post_init_entity_util_avg(struct sc > > sa->util_sum = sa->util_avg * LOAD_AVG_MAX; > > } > > > > - update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq, false); > > + if (entity_is_task(se)) { > > Why only task ? Only tasks can be of another class, the cgroup se's must be fair. > > + struct task_struct *p = task_of(se); > > + if (p->sched_class != &fair_sched_class) { > > + /* > > + * For !fair tasks do attach_entity_load_avg() > > + * followed by detach_entity_load_avg() as per > > + * switched_from_fair(). > > + */ > > + se->avg.last_update_time = now; > > + return; > > + } > > + } > > + > > + update_cfs_rq_load_avg(now, cfs_rq, false); > > attach_entity_load_avg(cfs_rq, se); > > Don't we have to do a complete attach with attach_task_cfs_rq instead > of just the load_avg ? to set also depth ? init_tg_cfs_entity() sets depth for cgroup entities, attach_task_cfs_rq() reset depth on switched_to(). So that should be fine. > --- > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -723,6 +723,7 @@ void post_init_entity_util_avg(struct sched_entity *se) > struct cfs_rq *cfs_rq = cfs_rq_of(se); > struct sched_avg *sa = &se->avg; > long cap = (long)(SCHED_CAPACITY_SCALE - cfs_rq->avg.util_avg) / 2; > + u64 now = cfs_rq_clock_task(cfs_rq); > > if (cap > 0) { > if (cfs_rq->avg.util_avg != 0) { > @@ -737,8 +738,18 @@ void post_init_entity_util_avg(struct sched_entity *se) > sa->util_sum = sa->util_avg * LOAD_AVG_MAX; > } > > - update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq, false); > - attach_entity_load_avg(cfs_rq, se); There is no p here... > + if (p->sched_class == &fair_sched_class) { > + /* fair entity must be attached to cfs_rq */ > + attach_task_cfs_rq(se); > + } else { > + /* > + * For !fair tasks do attach_entity_load_avg() > + * followed by detach_entity_load_avg() as per > + * switched_from_fair(). > + */ > + se->avg.last_update_time = now; > + } > + > } And you're now not attaching new cgroup thingies.