Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4564309ybi; Tue, 30 Jul 2019 04:19:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaS45r+GCnziHw7gznFS7sKsVUV06Irbd6vo2OqXsSgJBhpS0gpNEGs7gSzLo2aWaENRpu X-Received: by 2002:a17:902:b944:: with SMTP id h4mr38318992pls.179.1564485561764; Tue, 30 Jul 2019 04:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564485561; cv=none; d=google.com; s=arc-20160816; b=Uv7oxnJGBuowNr42hAXhEArBr2OXKaKTbDnel/WaN+UR3reolYos9rLyP26UNFV59c I+r7dvRPrYjJ+2934AHn3b1qV0KKUHMxgPsy4ZK132xP3OhaJnW3Wz1i1OSlhKvuHwVR L1xXJddrQLV9Ynf3NNbG2pryfYtNexUI/UZYOyWsS0WZBuUNg+rtudqSqDyLOZzJYiHG MA8KNIGZ8o3qWHb4lq2OFt3WOZOi5rksGHNDx/aFKVr9xwTsWKbm7osCxD+Ok3SsyYAL Brx/2454pKCd49x9tRgm8/uIjwWD/7P8yUIQGa3YF1tqF62LEd1Imsq5O/T2VWEkiTWD Wq/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BjOHjVPfh/LIDc/7yA8zCGr8rEtbAuSVPSXO0TtCsmw=; b=IpGpDeSmF03P7mLOcFbx7Z4SlTiEAVuGpspduAisc1bDrJcZJhjfzn/NTvjKIL9gcQ 7ahtrSopFOkurEs0+vys/0RfOGiAWF8Vzdsz16AIxeGFwAyGycDDLym4EIJM+gYg5y+z 36KDZo9CwfCiZMJF/wHMax8yJlHwEKCKzwABO+u/4TQL7AdDifbqvfajh4mAVdz0D+us N3VWoYfvaDFZC5AM7PTzukxQ1JiTgcVLW/pRNlTACRAjgpMxz1czy0lk33X5HTGVIfvd YWnmxtTdy3wBvD4k3layNnTTSqNKZXUKaKlvONE1j4aok3jqQ4eEjdYf8fNO8faj8zOW L8SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="Yda1/XJj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i94si26921860plb.78.2019.07.30.04.19.07; Tue, 30 Jul 2019 04:19:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="Yda1/XJj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731662AbfG3Jge (ORCPT + 99 others); Tue, 30 Jul 2019 05:36:34 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56488 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731650AbfG3Jgc (ORCPT ); Tue, 30 Jul 2019 05:36:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BjOHjVPfh/LIDc/7yA8zCGr8rEtbAuSVPSXO0TtCsmw=; b=Yda1/XJjb3FN+q2ECDJ6KEagM ssrhRStV83jWbvjnRgBm4fIf0BySi2pU8EmlG1CVG6llnlNT2ROpmZ1k/0wdr1T4il5KRcgzOXRY1 pZSxaC8CuYkwo49Ou5K5mcpbjII5VAtWsT9fFZdryg4TaTGb/ZSCX5wxcswS9EeK+iE2fYJ+7jTPB aw6JDXO3ptJ93jRGtmec0PMMwCP8uikcIYbDAc7lmSogV4ml8q8l41vyAspIIiT4rOnxwSP435Ckw poCOgxq6WRUm4Z9aBoOQuYOWo7w9PiShNmnlh0ZuCZnBYK66uhmBmyUmpdhfal6aMhH/sG5odmrt6 GmZJFR6rw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hsOYO-00062W-Kf; Tue, 30 Jul 2019 09:36:20 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7558520AFFE9E; Tue, 30 Jul 2019 11:36:17 +0200 (CEST) Date: Tue, 30 Jul 2019 11:36:17 +0200 From: Peter Zijlstra To: Rik van Riel Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, pjt@google.com, dietmar.eggemann@arm.com, mingo@redhat.com, morten.rasmussen@arm.com, tglx@linutronix.de, mgorman@techsingularity.net, vincent.guittot@linaro.org Subject: Re: [PATCH 09/14] sched,fair: refactor enqueue/dequeue_entity Message-ID: <20190730093617.GV31398@hirez.programming.kicks-ass.net> References: <20190722173348.9241-1-riel@surriel.com> <20190722173348.9241-10-riel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190722173348.9241-10-riel@surriel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 22, 2019 at 01:33:43PM -0400, Rik van Riel wrote: > Refactor enqueue_entity, dequeue_entity, and update_load_avg, in order > to split out the things we still want to happen at every level in the > cgroup hierarchy with a flat runqueue from the things we only need to > happen once. > > No functional changes. > @@ -3500,7 +3500,7 @@ static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s > #define DO_ATTACH 0x4 > > /* Update task and its cfs_rq load average */ > -static inline void update_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) > +static inline bool update_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) > { > u64 now = cfs_rq_clock_pelt(cfs_rq); > int decayed; > @@ -3529,6 +3529,8 @@ static inline void update_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s > > } else if (decayed && (flags & UPDATE_TG)) > update_tg_load_avg(cfs_rq, 0); > + > + return decayed; > } > > #ifndef CONFIG_64BIT > @@ -3745,9 +3747,10 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) > #define SKIP_AGE_LOAD 0x0 > #define DO_ATTACH 0x0 > > -static inline void update_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int not_used1) > +static inline bool update_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int not_used1) > { > cfs_rq_util_change(cfs_rq, 0); > + return false; > } > > static inline void remove_entity_load_avg(struct sched_entity *se) {} > @@ -3870,6 +3873,24 @@ static inline void check_schedstat_required(void) > * CPU and an up-to-date min_vruntime on the destination CPU. > */ > > +static bool > +enqueue_entity_groups(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) > +{ > + /* > + * When enqueuing a sched_entity, we must: > + * - Update loads to have both entity and cfs_rq synced with now. > + * - Add its load to cfs_rq->runnable_avg > + * - For group_entity, update its weight to reflect the new share of > + * its group cfs_rq > + * - Add its new weight to cfs_rq->load.weight > + */ > + if (!update_load_avg(cfs_rq, se, UPDATE_TG | DO_ATTACH)) > + return false; > + > + update_cfs_group(se); > + return true; > +} > + > static void > enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) > { > @@ -3894,16 +3915,6 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) > if (renorm && !curr) > se->vruntime += cfs_rq->min_vruntime; > > - /* > - * When enqueuing a sched_entity, we must: > - * - Update loads to have both entity and cfs_rq synced with now. > - * - Add its load to cfs_rq->runnable_avg > - * - For group_entity, update its weight to reflect the new share of > - * its group cfs_rq > - * - Add its new weight to cfs_rq->load.weight > - */ > - update_load_avg(cfs_rq, se, UPDATE_TG | DO_ATTACH); > - update_cfs_group(se); > enqueue_runnable_load_avg(cfs_rq, se); > account_entity_enqueue(cfs_rq, se); > No functional, but you did make update_cfs_group() conditional. Now that looks OK, but maybe you can do that part in a separate patch with a little justification of its own.