Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7348375ybi; Mon, 22 Jul 2019 11:27:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWHXDiSHXky9Y/3+XK5T4vkdQJHR6LY7Mpe5QFK/GWiVk6gQj1CSqfvAmI7nTdTiNFJiHr X-Received: by 2002:a17:902:b28b:: with SMTP id u11mr73251371plr.11.1563820043646; Mon, 22 Jul 2019 11:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563820043; cv=none; d=google.com; s=arc-20160816; b=dsvjlmTRq0c4woOIp5zl5OZrdpylYDB2w3FLR/YdggSnukQT2jigAOAD3CSN7w83uH /hGzvebXyHtMXc8NMWfO10k9v1VdC+mBOfb3USWAbxpQfynrEtRrQPZPOSDJuuV9dcqY pPIcYpDOOhSwgsIEyWoJuwRfW1NFFsD6rN9jsXWMmARPvHslNn/e4vrX+x16sfeU4v5o 1YIC5oaI8OrQlEjj5GT8hs0BKZSQfgPH310GrfNuT0oxaCNvILe1cu8C+HhJ1SP10Rc8 uHgp3yqV0lR8WzMaUkUVpSj/rLOp2ancq2mq9tDOwWf2VVZE7TpcRpqev/rGeNxcX4ka qoiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LM+mdPeKmtf1RtXd4jtka1l2mCEOD8Pokp7t4tG+ANI=; b=Ea1cJNjY4W2hFgtyh/z8lzSRUwa+qVIZxsIe8t7a8sOvy9VolmIIi09/jLsozWNyF9 vX8Y3SB+RQbu8gSfUjyEzsegM3rGTZ3RrWV/1bPuptK9lza/9sL4WoVH3DrwwbiU+wXa 4m7wWaDev/WYcIQFUTcTTP+nyqiRXKc20F4dQmw7XFmErOigk6+EtOewXcSkLSxsm0Ah 7wua+HtGiYH8TZIjnrzeXIeLx/XE/3ZHobvCIVWDAI4mX2+2BQ/4VyyuKJv2FOwvUF0X AocmkfgXM3BVHOj8e5N/pli2/jDYaaRsHrY3zciZamA6SspgMHW3aOmqQzcyPNdLB3yF XI1A== ARC-Authentication-Results: i=1; mx.google.com; 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 t17si11509279pfe.269.2019.07.22.11.27.07; Mon, 22 Jul 2019 11:27:23 -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; 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 S1728804AbfGVRfD (ORCPT + 99 others); Mon, 22 Jul 2019 13:35:03 -0400 Received: from shelob.surriel.com ([96.67.55.147]:37776 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbfGVReX (ORCPT ); Mon, 22 Jul 2019 13:34:23 -0400 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hpcC8-0003HL-Gd; Mon, 22 Jul 2019 13:33:52 -0400 From: Rik van Riel To: linux-kernel@vger.kernel.org Cc: kernel-team@fb.com, pjt@google.com, dietmar.eggemann@arm.com, peterz@infradead.org, mingo@redhat.com, morten.rasmussen@arm.com, tglx@linutronix.de, mgorman@techsingularity.net, vincent.guittot@linaro.org, Rik van Riel Subject: [PATCH 13/14] sched,fair: flatten update_curr functionality Date: Mon, 22 Jul 2019 13:33:47 -0400 Message-Id: <20190722173348.9241-14-riel@surriel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190722173348.9241-1-riel@surriel.com> References: <20190722173348.9241-1-riel@surriel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make it clear that update_curr only works on tasks any more. There is no need for task_tick_fair to call it on every sched entity up the hierarchy, so move the call out of entity_tick. Signed-off-by: Rik van Riel ` Header from folded patch 'fix-attach-detach_enticy_cfs_rq.patch': Subject: sched,fair: fix attach/detach_entity_cfs_rq While attach_entity_cfs_rq and detach_entity_cfs_rq should iterate over the hierarchy, they do not need to so that twice. Passing flags into propagate_entity_cfs_rq allows us to reuse that same loop from other functions. Signed-off-by: Rik van Riel --- kernel/sched/fair.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 224cd9b20887..4c7e1818efba 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -872,10 +872,11 @@ static void update_tg_load_avg(struct cfs_rq *cfs_rq, int force) static void update_curr(struct cfs_rq *cfs_rq) { struct sched_entity *curr = cfs_rq->curr; + struct task_struct *curtask; u64 now = rq_clock_task(rq_of(cfs_rq)); u64 delta_exec; - if (unlikely(!curr)) + if (unlikely(!curr) || !entity_is_task(curr)) return; delta_exec = now - curr->exec_start; @@ -893,13 +894,10 @@ static void update_curr(struct cfs_rq *cfs_rq) curr->vruntime += calc_delta_fair(delta_exec, curr); update_min_vruntime(cfs_rq); - if (entity_is_task(curr)) { - struct task_struct *curtask = task_of(curr); - - trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime); - cgroup_account_cputime(curtask, delta_exec); - account_group_exec_runtime(curtask, delta_exec); - } + curtask = task_of(curr); + trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime); + cgroup_account_cputime(curtask, delta_exec); + account_group_exec_runtime(curtask, delta_exec); account_cfs_rq_runtime(cfs_rq, delta_exec); } @@ -4192,11 +4190,6 @@ static void put_prev_entity(struct cfs_rq *cfs_rq, struct sched_entity *prev) static void entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) { - /* - * Update run-time statistics of the 'current'. - */ - update_curr(cfs_rq); - /* * Ensure that runnable average is periodically updated. */ @@ -10025,6 +10018,11 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) struct cfs_rq *cfs_rq; struct sched_entity *se = &curr->se; + /* + * Update run-time statistics of the 'current'. + */ + update_curr(&rq->cfs); + for_each_sched_entity(se) { cfs_rq = group_cfs_rq_of_parent(se); entity_tick(cfs_rq, se, queued); -- 2.20.1