Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp115872ybx; Wed, 30 Oct 2019 12:12:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwNtncwO/AVJvLRGaqFH9D11FRN+aBOQ7FlGhr0Px0gWOuMhbSzXERHOMlXvrIjOrjn9WY X-Received: by 2002:a17:906:3285:: with SMTP id 5mr1122628ejw.143.1572462748017; Wed, 30 Oct 2019 12:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572462748; cv=none; d=google.com; s=arc-20160816; b=s3v/wg7wNQuQwBpDj7c6hVGCKcJ63pyjVpCkkmW2XRGkHRqkdD+MkxYXF+8q/RG1OQ PvQZircNTZZqSn6NwgD6KmpL/JPN+Us+zFcILEuvn4TXnlDO6Kccy9WdXjs0AAtZSBqV H90ZkV0j3mcLwC4L2fNVwVp7bxGqVGshXUaeOxP71ifmU+CLt9e4u1RrNtl02BJq/4fa 88Ew7PneTU1xstAbrc5jP4RSSlGH5S1e1pDgNzzoHPorndMgecjAsgrJwAYdHLFHsbVg T0cdITWY8VZqedJ/HTuWS3pgMPCaRoCaBTt6rLGZ7Dni0uAxObbvC/Tj3S6WXeHuFClV aawQ== 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=bvG8yeMiWehpYWmsEhmZrRBzQ/KLeRP0kdYcoAuh+Ag=; b=U0ix3iir9KwCuQ6e69jKHJ3KInRpS3FiOea8uWvDF7aSedPrFTMIBCklUmqSzoy0yd v0g/W3sGNb0BYmLgtm4bgUykBikuDCbvP0187WwNoOCabPu4DNWNx+FeB/8/FYP5HJpX VzEUBszjnwRfsaDZ5asHU3MxJ/pcMjDNRaY80HylyFXO7aDs7OKnZJoPJ82xf9N/wFgh eQseqD7MRaxEKcqsPqm00sLwVqbMj1Wb0Yb95rtwIFaT390jtyN/jZJhuoC1s18zNIEt dufSDJNnN6aqH6EWcGyNQPlLSK6bo5cr90BfeC+LZmLSJ37vSfTYMikV/uMfIawBDSMz mOSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=gdzWXXbK; 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 r8si2053753eju.426.2019.10.30.12.12.04; Wed, 30 Oct 2019 12:12:28 -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=pass header.i=@digitalocean.com header.s=google header.b=gdzWXXbK; 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 S1728207AbfJ3See (ORCPT + 99 others); Wed, 30 Oct 2019 14:34:34 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:45396 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728092AbfJ3Sea (ORCPT ); Wed, 30 Oct 2019 14:34:30 -0400 Received: by mail-yb1-f194.google.com with SMTP id q143so1290753ybg.12 for ; Wed, 30 Oct 2019 11:34:29 -0700 (PDT) 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=bvG8yeMiWehpYWmsEhmZrRBzQ/KLeRP0kdYcoAuh+Ag=; b=gdzWXXbKeE5D6zaJ9uerEsRUOkxrxdmScqSaicrvmuj5TfYMrri0nid6IyseVMjHHy 6sGskBkw0HIhghgDaWsygrIs3IQ++dvAQhdNg1mEELSls3VthJB+sNYfEkJgthlAe/vQ LXPwmhs8D1y/ThK+PFuHJ9M5VzI7VGU2s0ZDs= 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=bvG8yeMiWehpYWmsEhmZrRBzQ/KLeRP0kdYcoAuh+Ag=; b=KoTCU/AqdexkaDwOM4lmKVS3NVo/tbhdOrR1GjEPbcWslxooqFzaRX8gETLRSnEXmt yvdHmGO3cQrCsiyMwKcp8M3mq1OiO23PdanNjyAhaCA0g4uaGFln+Eb5fHRiqpbpO6sM j2ASxXhRIuZnt4z2S3fhxAhQQ8S/pqQn6MNCXzSc6SBvgwJx/mU8b1XJxE29gp3XkV6Z XZWboZU06I4yg3sY5OR/684skmhWx5nxjSvtUT2jyH2uYaySox4oa7Rmng4i3BTqFz/A lL4dD4+tN3cRtNTEAXwDtph3bhmntCAKzYAT1BA2Yhcq0Mhc/AC5svdnMIdehszWfOFm rFoA== X-Gm-Message-State: APjAAAVXBMUyv6+7uY7WdlApd3H7qi191u/XyTPWuNdfUTgssQvdJbEy fCssnRpK1K7QCJXS6uPQiVoNCQ== X-Received: by 2002:a25:c5c4:: with SMTP id v187mr656072ybe.32.1572460469281; Wed, 30 Oct 2019 11:34:29 -0700 (PDT) Received: from vpillai-dev.sfo2.internal.digitalocean.com ([138.68.32.68]) by smtp.gmail.com with ESMTPSA id s84sm818549yws.22.2019.10.30.11.34.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2019 11:34:28 -0700 (PDT) From: Vineeth Remanan Pillai 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, Dario Faggioli , fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Aaron Lu , Aubrey Li , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Aaron Lu Subject: [RFC PATCH v4 17/19] sched/fair: wrapper for cfs_rq->min_vruntime Date: Wed, 30 Oct 2019 18:33:30 +0000 Message-Id: <7b14ed09002916e6ccba1989b9beb2433be31dc2.1572437285.git.vpillai@digitalocean.com> 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 840d27628d36..ab32b22b0574 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -450,6 +450,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); @@ -486,7 +491,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) @@ -506,7 +511,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; @@ -3816,7 +3821,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; @@ -3829,7 +3834,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, @@ -3922,7 +3927,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); @@ -3933,7 +3938,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: @@ -4046,7 +4051,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); @@ -6542,7 +6547,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; @@ -10007,7 +10012,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); } @@ -10127,7 +10132,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); @@ -10141,7 +10146,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