From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>,
cgroups@vger.kernel.org, containers@lists.linux-foundation.org
Subject: [PATCH RFC 2/3] sched/fair: copy taskgroup shares to each cfs_rq
Date: Mon, 16 May 2016 12:36:31 +0300 [thread overview]
Message-ID: <146339139131.25295.4898290002699620951.stgit@buzz> (raw)
In-Reply-To: <146339085068.25295.7687045977863852568.stgit@buzz>
This will be used for tweaking shares in runtime.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
kernel/sched/fair.c | 12 +++++++-----
kernel/sched/sched.h | 1 +
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d26b631a9a1d..5bf34532d364 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2469,21 +2469,21 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
tg_weight = calc_tg_weight(tg, cfs_rq);
load = cfs_rq->load.weight;
- shares = (tg->shares * load);
+ shares = (cfs_rq->shares * load);
if (tg_weight)
shares /= tg_weight;
if (shares < MIN_SHARES)
shares = MIN_SHARES;
- if (shares > tg->shares)
- shares = tg->shares;
+ if (shares > cfs_rq->shares)
+ shares = cfs_rq->shares;
return shares;
}
# else /* CONFIG_SMP */
static inline long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
{
- return tg->shares;
+ return cfs_rq->shares;
}
# endif /* CONFIG_SMP */
static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
@@ -2515,7 +2515,7 @@ static void update_cfs_shares(struct cfs_rq *cfs_rq)
if (!se || throttled_hierarchy(cfs_rq))
return;
#ifndef CONFIG_SMP
- if (likely(se->load.weight == tg->shares))
+ if (likely(se->load.weight == cfs_rq->shares))
return;
#endif
shares = calc_cfs_shares(cfs_rq, tg);
@@ -8439,6 +8439,7 @@ void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
se->my_q = cfs_rq;
/* guarantee group entities always have weight */
+ cfs_rq->shares = NICE_0_LOAD;
update_load_set(&se->load, NICE_0_LOAD);
se->parent = parent;
}
@@ -8473,6 +8474,7 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
/* Possible calls to update_curr() need rq clock */
update_rq_clock(rq);
+ group_cfs_rq(se)->shares = shares;
for_each_sched_entity(se)
update_cfs_shares(group_cfs_rq(se));
raw_spin_unlock_irqrestore(&rq->lock, flags);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index ec2e8d23527e..e75e755ee5e9 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -422,6 +422,7 @@ struct cfs_rq {
int on_list;
struct list_head leaf_cfs_rq_list;
struct task_group *tg; /* group that "owns" this runqueue */
+ unsigned long shares;
#ifdef CONFIG_CFS_BANDWIDTH
int runtime_enabled;
next prev parent reply other threads:[~2016-05-16 9:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-16 9:36 [PATCH RFC 0/3] sched/fair: cpu time reserves for cgroups Konstantin Khlebnikov
2016-05-16 9:36 ` [PATCH RFC 1/3] sched/fair: call __refill_cfs_bandwidth_runtime only for finite quota Konstantin Khlebnikov
2016-05-16 9:36 ` Konstantin Khlebnikov [this message]
2016-05-16 9:36 ` [PATCH RFC 3/3] sched/fair: pulse-weight modulation controller for cpu cgroup Konstantin Khlebnikov
2016-05-16 11:18 ` [PATCH RFC 0/3] sched/fair: cpu time reserves for cgroups Peter Zijlstra
2016-05-16 12:22 ` Konstantin Khlebnikov
2016-05-16 12:26 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=146339139131.25295.4898290002699620951.stgit@buzz \
--to=khlebnikov@yandex-team.ru \
--cc=cgroups@vger.kernel.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox