Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3409245lkq; Mon, 23 Nov 2020 05:05:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdqDZX93RI7QR7fffxY7FPCILKqNVH+yQ5w30SCzVKS9FCO8mfFciVtKI7qIwzn3Elq0cM X-Received: by 2002:a17:906:a186:: with SMTP id s6mr45361039ejy.193.1606136709071; Mon, 23 Nov 2020 05:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606136709; cv=none; d=google.com; s=arc-20160816; b=VcXpIHTuM99L9IrcdcWhnfSJchovMM0tOVRM1xcmNi19pcf2IMRUr+V48h0ImKg18R MnDtagn230nHIIR6sCqG8nWFyVWez+IccXv5WFHUyiBSgCUk4KbdpmWgPT9LN7+IXTYK Z4Hh1FHJekwrkUI09BBnUBD0+XwtHVUnh2lkAk5V6ri+89u1ns1EPESSCEfCO4bmKKbz r9nU0Q2dhv8ddv00DO8Kjjc9V9GeIJ8uFKzfogifbSX338uEZqPIN6CnxPXdLfgobHxu 9dCVSQuXxqOed//bBgGWU7Cb2O+almA00a0FKXGPEV3/kTRTH74RUa+iqwSuIQCtUPYF CIKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UBZC3oh3zblyjdeIOfJKrQPEZerRPY4V37fF8XKdWfQ=; b=GUg6XlpDMMRR8aDkfs+evGWaq9OJwH0cImpLOXyIhWPeUF+WHej1uesJxN3F7Qh+q6 MgzczflFuNVmnP4OCRptvOUt+kq6fNjlQdGxNsABl8Kimcs/BjAjbvaf6mSDTJwmgqI4 feNQwYV4HlUnkBlkMFIQ3IiyCuXJpXCKKtFc2oZpucj2P87PhhGeRmX+IT8q5FJv087K hxO5jPDZCq2DgwH/r4c1JgsJDuFHksnff4u1nP98ws3NLtFIuE8o+RE7wvBdxnKjBs8u jgeg8UiZeX4EqHTOShAZ4YRbCHg6iqYRXPnBb2zQVo5erASWdVMi20IQvFHRXcvab6R8 IacQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JwCbmYUF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn2si5161388ejb.373.2020.11.23.05.04.34; Mon, 23 Nov 2020 05:05:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JwCbmYUF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388191AbgKWNAP (ORCPT + 99 others); Mon, 23 Nov 2020 08:00:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388089AbgKWM7Q (ORCPT ); Mon, 23 Nov 2020 07:59:16 -0500 Received: from mail-ua1-x942.google.com (mail-ua1-x942.google.com [IPv6:2607:f8b0:4864:20::942]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21E1EC0613CF; Mon, 23 Nov 2020 04:59:12 -0800 (PST) Received: by mail-ua1-x942.google.com with SMTP id 103so2302487uai.9; Mon, 23 Nov 2020 04:59:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UBZC3oh3zblyjdeIOfJKrQPEZerRPY4V37fF8XKdWfQ=; b=JwCbmYUFZndqE5USltdqIcZR9zNfa8+6CuI03mxaIoxcLjyCTu964vbGfoegJKs1VN wSfPrAPDzEVYh03a7QIeNq/cWbZlPyrVecPFb8mDtaL2Dm7gynRR48tI2dyygVm5GJPf du1ErgNAmjaVySrZqKmW/qdxDXr0pJBrphTCcU41gEM25uMNuGnv8JayQjyCYCkVj/r2 0tYi8vSAUQCLz4AL9hnjUHIqdopPXtlVtBThyEW9PwpLB7To90fEwUu6nyEJWYUJTyus U9v5xq92HiKR6jY6ROitdq6/flzc7JvOLu48L3sQmkToGpt4LvHp5Ie15+mnbOjHri1C xYmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UBZC3oh3zblyjdeIOfJKrQPEZerRPY4V37fF8XKdWfQ=; b=GGGjYPLKuTpBr/l/9VuyaQ4BmHGiJ5zKQpj4g8UgM9yLi6FogU1gYPnkFvMRd6MswJ n6NROJeFlIJH4MK2HRwQHj+gRZGClCnsqjaP4d+vUoWbfSq0fAZLE8ZATCkHhk59+64b SAfOmfRTO5pi8LSDr/v6xqrmp5v+JKtlpGg3/xvC0bSNBhvNFQEJzfOCWbRKYOG2vjdc VB+EHTJwXcLh8uAWIL7l9HP/jkoBM9nH3etXPjQxfQVLqyUfQyGCfW5ZnPFCSoHCEtBf NdVkjUCEumh1XA6ORC+b0meTT6/P2hi52o3v/v/wT2Qrd7IXHjPNhx0GcrsgK/2c3A0c Fe4w== X-Gm-Message-State: AOAM531TkBw3R2nBx2RzCYs+3Rt+b1Z0BNZaKJz1Vwus3o+y/G8t9FAf G6YSQ1QmiTURqKxo6bHHB5M= X-Received: by 2002:ab0:35c8:: with SMTP id x8mr736382uat.72.1606136351324; Mon, 23 Nov 2020 04:59:11 -0800 (PST) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id h16sm1579091uaw.7.2020.11.23.04.59.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Nov 2020 04:59:10 -0800 (PST) From: Yafang Shao To: mgorman@suse.de, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Yafang Shao Subject: [RFC PATCH v2 4/5] sched: define update_stats_curr_start() as a common helper Date: Mon, 23 Nov 2020 20:58:07 +0800 Message-Id: <20201123125808.50896-5-laoar.shao@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20201123125808.50896-1-laoar.shao@gmail.com> References: <20201123125808.50896-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org update_stats_curr_start() is used to update the exec_start when we are starting a new run period, which is used by all sched class. So we'd better define it as a common helper. Signed-off-by: Yafang Shao --- kernel/sched/fair.c | 14 +------------- kernel/sched/rt.c | 2 +- kernel/sched/sched.h | 12 ++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 946b60f586e4..13e803369ced 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -915,18 +915,6 @@ update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) } } -/* - * We are picking a new current task - update its stats: - */ -static inline void -update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se) -{ - /* - * We are starting a new run period: - */ - se->exec_start = rq_clock_task(rq_of(cfs_rq)); -} - /************************************************** * Scheduling class queueing methods: */ @@ -4255,7 +4243,7 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) update_load_avg(cfs_rq, se, UPDATE_TG); } - update_stats_curr_start(cfs_rq, se); + update_stats_curr_start(rq_of(cfs_rq), se); cfs_rq->curr = se; /* diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index af772ac0f32d..3422dd85cfb4 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1574,7 +1574,7 @@ static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p, int flag static inline void set_next_task_rt(struct rq *rq, struct task_struct *p, bool first) { - p->se.exec_start = rq_clock_task(rq); + update_stats_curr_start(rq, &p->se); /* The running task is never eligible for pushing */ dequeue_pushable_task(rq, p); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 9a4576ccf3d7..3948112dc31c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2644,4 +2644,16 @@ static inline struct task_struct *task_of(struct sched_entity *se) return container_of(se, struct task_struct, se); } +/* + * We are picking a new current task - update its stats: + */ +static inline void +update_stats_curr_start(struct rq *rq, struct sched_entity *se) +{ + /* + * We are starting a new run period: + */ + se->exec_start = rq_clock_task(rq); +} + #endif /* _KERNEL_SCHED_SCHED_H */ -- 2.18.4