From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753987AbcEaMEA (ORCPT ); Tue, 31 May 2016 08:04:00 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:51785 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753667AbcEaMD5 (ORCPT ); Tue, 31 May 2016 08:03:57 -0400 Date: Tue, 31 May 2016 14:03:52 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: Yuyang Du , Ingo Molnar , linux-kernel , Benjamin Segall , Paul Turner , Morten Rasmussen , Dietmar Eggemann Subject: Re: [PATCH v2 2/3] sched/fair: Skip detach and attach new group task Message-ID: <20160531120352.GK3193@twins.programming.kicks-ass.net> References: <1464647577-23057-1-git-send-email-yuyang.du@intel.com> <1464647577-23057-3-git-send-email-yuyang.du@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, May 31, 2016 at 01:55:49PM +0200, Vincent Guittot wrote: > Hi Yuyang, > > On 31 May 2016 at 00:32, Yuyang Du wrote: > > Vincent reported that the first task to a new task group's cfs_rq will > > be attached in attach_task_cfs_rq() and once more when it is enqueued > > (see https://lkml.org/lkml/2016/5/25/388). > > > > Actually, it is worse, attach_task_cfs_rq() is invoked for new task even > > way before the new task is initiated in init_entity_runnable_average(). > > > > Solve this by avoiding attach as well as detach new task in > > task_move_group_fair(). To do it, we need to know whether the task > > is forked or not, so we pass this info all the way from sched_move_task() > > to attach_task_cfs_rq(). > > I have tested your patch and I can't the spurious detach > /attach_task_cfs_rq anymore > so you can add my tested-by. > Could someone update the Changelog to better explain the whole callchain. Because a quick look seems to suggest something like: copy_process() sched_fork() ... cgroup_post_fork() ss->fork() := cpu_cgroup_fork() Which seems to suggest init_entity_runnable_average() is placed wrong and should live in sched_fork() ? Or am I not getting it.. ?