From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932983AbcJZLQ2 (ORCPT ); Wed, 26 Oct 2016 07:16:28 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:48987 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932865AbcJZLQW (ORCPT ); Wed, 26 Oct 2016 07:16:22 -0400 Date: Wed, 26 Oct 2016 13:16:17 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: Dietmar Eggemann , Ingo Molnar , linux-kernel , Yuyang Du , Morten Rasmussen , "linaro-kernel@lists.linaro.org" , Paul Turner , Ben Segall , Wanpeng Li Subject: Re: [PATCH 4/6 v5] sched: propagate load during synchronous attach/detach Message-ID: <20161026111617.GF3102@twins.programming.kicks-ass.net> References: <1476695653-12309-1-git-send-email-vincent.guittot@linaro.org> <1476695653-12309-5-git-send-email-vincent.guittot@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Oct 26, 2016 at 09:05:49AM +0200, Vincent Guittot wrote: > > > > The 'detach across' and 'attach across' in detach_task_cfs_rq() and > > attach_entity_cfs_rq() do the same so couldn't you not create a > > function propagate_foo() for it? This would avoid this ifdef as > > well. > > > > You could further create in your '[PATCH 1/6 v5] sched: factorize attach entity': > > > > detach_entity_cfs_rq() { > > update_load_avg() > > detach_entity_load_avg() > > update_tg_load_avg() > > propagate_load_avg() > > } > > > > and then we would have: > > > > attach_task_cfs_rq() -> attach_entity_cfs_rq() -> propagate_foo() > > detach_task_cfs_rq() -> detach_entity_cfs_rq() -> propagate_foo() > > > > I guess you didn't because it would be only called one time but this > > symmetric approaches are easier to remember (at least for me). > > Yes i haven't created attach_entity_cfs_rq because it would be used only once. > Regarding the creation of a propagate_foo function, i have just > followed a similar skeleton as what is done in > enqueue/dequeue_task_fair > > I don't have strong opinion about creating this indirection for code > readability. Others, have you got a preference ? I think I agree with Dietmar. Duplicate code needs a helper function and it would be nice to keep symmetry, even if there's only a single call site.