Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4702855ybf; Wed, 4 Mar 2020 09:02:12 -0800 (PST) X-Google-Smtp-Source: ADFU+vtq4udzMynjdTpPU/8VXasWocBKc1/mOWd1L9tmzpUGXkmIqabFGqWkTFhV3+KFRaIKz6Si X-Received: by 2002:a05:6808:45:: with SMTP id v5mr2340443oic.90.1583341332059; Wed, 04 Mar 2020 09:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583341332; cv=none; d=google.com; s=arc-20160816; b=dEHzZXf/hTtIGqUfF0ACGGU1nMvozFo/bf3SHH8jPxIa7zatbbB8cfSDqXGSmFj39X tW4YTL51VPnfaPP2fkKVDksr/axGj31l7iU67gjM2HgpTanaHt6x6IMiOQr9Y1jiRLRh 2eqGjgoeroQyJn37Q7P2qfXBJdPnjZtKNICaKlVdrIlprIGGKWo6IqqQ6P6jPQxvnEeW XwSlw44ASXt4dCJqjofVDcYHD8OcMYfjjM7Cpkn2m/2l/btclPLh6hB0fyzqa3WZnRvY 0CUOe5Aql0PFLTWc+nmVR3UhexqqW1rwDxc8N0xMTACVPPAaBkCv+ncPNBcq+wJRr/9A bMAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=h1GH+76TwcdeB8gyOGGpP+hPF6EPEqc5BR+0YK2ci0E=; b=V1uWsJeU1Ru02DJ4UB+N7bLaQXj8i/xWuoBT0wTVwY/iw5wkBWyRMulNKFEXC9iZfN UJAGGJbHL0JyZT9+qVb4JbmVOotc5Z7BKpKe6xdY1Nfp8yNMiXP8JtZsKiOOrs8ZeOaq xNkCRubYoFbq+ryF1DGblF6etMrlEPcmQ6nGpCC8JV6Os4U9vxWAVCPRZByzVPwjOXRW tIRmNUHg/NHX4+GNPXsh/q5BoBKbK9qzmJkW469EC+RQ7gzDF95WFS6BAAd1CgkH0tsC nNzlnAZQrZkGx2BEVtKLBcxy9qY9Dh3mvWLE5J1U2Ru2+Tv1Ql/fF5i8ubEXsLGEIknU Tzbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=arqxrRo6; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a25si1445863oid.67.2020.03.04.09.01.56; Wed, 04 Mar 2020 09:02:12 -0800 (PST) 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=pass header.i=@digitalocean.com header.s=google header.b=arqxrRo6; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388434AbgCDRAn (ORCPT + 99 others); Wed, 4 Mar 2020 12:00:43 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36812 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388355AbgCDRAR (ORCPT ); Wed, 4 Mar 2020 12:00:17 -0500 Received: by mail-qt1-f195.google.com with SMTP id t13so1898738qto.3 for ; Wed, 04 Mar 2020 09:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digitalocean.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=h1GH+76TwcdeB8gyOGGpP+hPF6EPEqc5BR+0YK2ci0E=; b=arqxrRo6iBQZYgD4el5BzHEJo+btFpwG7TPO73V+yyhugzEwjIJazuU18qpVQrfdKt qbEvLKHL0FIPzlwzxvGlBJX2WeXxRfo/903ppr+HYushvdJ6CE3a3RQ7cT0QFk64XFL/ Z/xMzQN7PSgmlY0duOLTQS5++GHbV/6YpiD60= 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:in-reply-to:references; bh=h1GH+76TwcdeB8gyOGGpP+hPF6EPEqc5BR+0YK2ci0E=; b=jOTSMep8VT8YemKlx+p50MiGzWNmytEXF/YnAZJVHkxCe1OmcvgyDnPUznIT5rXHQW vPqHMqpXkonz9sAtgp2sNXdaw8WeJcUG3Hi1GsOr0c2ch37MmgsiD/hgZfd3cPjFhalc EjCRdljBtCUGg2rlj3l70WtelAvmeNG4mxcVqASPpiWck2AUesTns0q/o/iFqHh5wpRC dS/sJd26ermRoKC0mlhcLxJASExeDMlelnv7W36jqNE2gRyNJ3+ulC6j1p1ug0eSvKgo B11tnXO9tpOehlh+CsqtdX0bApgYy9qGY/3yH7UEwfW7AYLhscnEe7MTVB6j1ao8gFe5 OO0w== X-Gm-Message-State: ANhLgQ3YF//BJ2PRQrFBYzAJkQGTKdSV2x1FB9Ojj6jTAJTh1ABfqYcl OO1cb4bULDGwW1kDizV/oAoBxw== X-Received: by 2002:ac8:4616:: with SMTP id p22mr3264006qtn.64.1583341215460; Wed, 04 Mar 2020 09:00:15 -0800 (PST) Received: from s2r5node9 ([162.243.188.99]) by smtp.gmail.com with ESMTPSA id k50sm14675628qtc.90.2020.03.04.09.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 09:00:15 -0800 (PST) From: vpillai To: Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Tim Chen , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, torvalds@linux-foundation.org Cc: Aaron Lu , linux-kernel@vger.kernel.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Aaron Lu , Aubrey Li , aubrey.li@linux.intel.com, Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Joel Fernandes , joel@joelfernandes.org, Aaron Lu Subject: [RFC PATCH 08/13] sched/fair: wrapper for cfs_rq->min_vruntime Date: Wed, 4 Mar 2020 16:59:58 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aaron Lu Add a wrapper function cfs_rq_min_vruntime(cfs_rq) to return cfs_rq->min_vruntime. It will be used in the following patch, no functionality change. Signed-off-by: Aaron Lu --- kernel/sched/fair.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8432de767730..d99ea6ee7af2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -449,6 +449,11 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse) #endif /* CONFIG_FAIR_GROUP_SCHED */ +static inline u64 cfs_rq_min_vruntime(struct cfs_rq *cfs_rq) +{ + return cfs_rq->min_vruntime; +} + static __always_inline void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec); @@ -485,7 +490,7 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq) struct sched_entity *curr = cfs_rq->curr; struct rb_node *leftmost = rb_first_cached(&cfs_rq->tasks_timeline); - u64 vruntime = cfs_rq->min_vruntime; + u64 vruntime = cfs_rq_min_vruntime(cfs_rq); if (curr) { if (curr->on_rq) @@ -505,7 +510,7 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq) } /* ensure we never gain time by being placed backwards. */ - cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime); + cfs_rq->min_vruntime = max_vruntime(cfs_rq_min_vruntime(cfs_rq), vruntime); #ifndef CONFIG_64BIT smp_wmb(); cfs_rq->min_vruntime_copy = cfs_rq->min_vruntime; @@ -3833,7 +3838,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {} static void check_spread(struct cfs_rq *cfs_rq, struct sched_entity *se) { #ifdef CONFIG_SCHED_DEBUG - s64 d = se->vruntime - cfs_rq->min_vruntime; + s64 d = se->vruntime - cfs_rq_min_vruntime(cfs_rq); if (d < 0) d = -d; @@ -3846,7 +3851,7 @@ static void check_spread(struct cfs_rq *cfs_rq, struct sched_entity *se) static void place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) { - u64 vruntime = cfs_rq->min_vruntime; + u64 vruntime = cfs_rq_min_vruntime(cfs_rq); /* * The 'current' period is already promised to the current tasks, @@ -3939,7 +3944,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) * update_curr(). */ if (renorm && curr) - se->vruntime += cfs_rq->min_vruntime; + se->vruntime += cfs_rq_min_vruntime(cfs_rq); update_curr(cfs_rq); @@ -3950,7 +3955,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) * fairness detriment of existing tasks. */ if (renorm && !curr) - se->vruntime += cfs_rq->min_vruntime; + se->vruntime += cfs_rq_min_vruntime(cfs_rq); /* * When enqueuing a sched_entity, we must: @@ -4063,7 +4068,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) * can move min_vruntime forward still more. */ if (!(flags & DEQUEUE_SLEEP)) - se->vruntime -= cfs_rq->min_vruntime; + se->vruntime -= cfs_rq_min_vruntime(cfs_rq); /* return excess runtime on last dequeue */ return_cfs_rq_runtime(cfs_rq); @@ -6396,7 +6401,7 @@ static void migrate_task_rq_fair(struct task_struct *p, int new_cpu) min_vruntime = cfs_rq->min_vruntime; } while (min_vruntime != min_vruntime_copy); #else - min_vruntime = cfs_rq->min_vruntime; + min_vruntime = cfs_rq_min_vruntime(cfs_rq); #endif se->vruntime -= min_vruntime; @@ -10382,7 +10387,7 @@ static void task_fork_fair(struct task_struct *p) resched_curr(rq); } - se->vruntime -= cfs_rq->min_vruntime; + se->vruntime -= cfs_rq_min_vruntime(cfs_rq); rq_unlock(rq, &rf); } @@ -10502,7 +10507,7 @@ static void detach_task_cfs_rq(struct task_struct *p) * cause 'unlimited' sleep bonus. */ place_entity(cfs_rq, se, 0); - se->vruntime -= cfs_rq->min_vruntime; + se->vruntime -= cfs_rq_min_vruntime(cfs_rq); } detach_entity_cfs_rq(se); @@ -10516,7 +10521,7 @@ static void attach_task_cfs_rq(struct task_struct *p) attach_entity_cfs_rq(se); if (!vruntime_normalized(p)) - se->vruntime += cfs_rq->min_vruntime; + se->vruntime += cfs_rq_min_vruntime(cfs_rq); } static void switched_from_fair(struct rq *rq, struct task_struct *p) -- 2.17.1