mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Turner <pjt@google.com>
To: Michael Wang <wangyun@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 1/3] sched: don't repeat the initialization in sched_init()
Date: Mon, 3 Jun 2013 23:52:20 -0700	[thread overview]
Message-ID: <CAPM31RJfWWJuMg-2Byb7uGFQPQY1v+8OWVpwO2Ggz_mtTYpjVQ@mail.gmail.com> (raw)
In-Reply-To: <51AD87D0.7020300@linux.vnet.ibm.com>

On Mon, Jun 3, 2013 at 11:23 PM, Michael Wang
<wangyun@linux.vnet.ibm.com> wrote:
> In sched_init(), there is no need to initialize 'root_task_group.shares' and
> 'root_task_group.cfs_bandwidth' repeatedly.
>
> CC: Ingo Molnar <mingo@kernel.org>
> CC: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
> ---
>  kernel/sched/core.c |   46 +++++++++++++++++++++++++---------------------
>  1 files changed, 25 insertions(+), 21 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 58453b8..c0c3716 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6955,6 +6955,31 @@ void __init sched_init(void)
>
>  #endif /* CONFIG_CGROUP_SCHED */
>
> +#ifdef CONFIG_FAIR_GROUP_SCHED
> +       root_task_group.shares = ROOT_TASK_GROUP_LOAD;
> +
> +       /*
> +        * How much cpu bandwidth does root_task_group get?
> +        *
> +        * In case of task-groups formed thr' the cgroup filesystem, it
> +        * gets 100% of the cpu resources in the system. This overall
> +        * system cpu resource is divided among the tasks of
> +        * root_task_group and its child task-groups in a fair manner,
> +        * based on each entity's (task or task-group's) weight
> +        * (se->load.weight).
> +        *
> +        * In other words, if root_task_group has 10 tasks of weight
> +        * 1024) and two child groups A0 and A1 (of weight 1024 each),
> +        * then A0's share of the cpu resource is:
> +        *
> +        *      A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33%
> +        *
> +        * We achieve this by letting root_task_group's tasks sit
> +        * directly in rq->cfs (i.e root_task_group->se[] = NULL).
> +        */

This comment has become unglued from what it's supposed to be attached
to (it's tied to root_task_group.shares & init_tg_cfs_entry, not
init_cfs_bandwidth).

> +       init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
> +#endif
> +
>         for_each_possible_cpu(i) {
>                 struct rq *rq;
>
> @@ -6966,28 +6991,7 @@ void __init sched_init(void)
>                 init_cfs_rq(&rq->cfs);
>                 init_rt_rq(&rq->rt, rq);
>  #ifdef CONFIG_FAIR_GROUP_SCHED
> -               root_task_group.shares = ROOT_TASK_GROUP_LOAD;
>                 INIT_LIST_HEAD(&rq->leaf_cfs_rq_list);
> -               /*
> -                * How much cpu bandwidth does root_task_group get?
> -                *
> -                * In case of task-groups formed thr' the cgroup filesystem, it
> -                * gets 100% of the cpu resources in the system. This overall
> -                * system cpu resource is divided among the tasks of
> -                * root_task_group and its child task-groups in a fair manner,
> -                * based on each entity's (task or task-group's) weight
> -                * (se->load.weight).
> -                *
> -                * In other words, if root_task_group has 10 tasks of weight
> -                * 1024) and two child groups A0 and A1 (of weight 1024 each),
> -                * then A0's share of the cpu resource is:
> -                *
> -                *      A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33%
> -                *
> -                * We achieve this by letting root_task_group's tasks sit
> -                * directly in rq->cfs (i.e root_task_group->se[] = NULL).
> -                */
> -               init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
>                 init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL);
>  #endif /* CONFIG_FAIR_GROUP_SCHED */
>
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2013-06-04  6:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04  6:22 [PATCH 0/3] sched: code refine/clean for cfs-bandwidth Michael Wang
2013-06-04  6:23 ` [PATCH 1/3] sched: don't repeat the initialization in sched_init() Michael Wang
2013-06-04  6:52   ` Paul Turner [this message]
2013-06-04  7:23     ` Michael Wang
2013-06-05  2:24   ` [PATCH v2 " Michael Wang
2013-06-05 11:06     ` Peter Zijlstra
2013-06-06  2:19       ` Michael Wang
2013-06-04  6:23 ` [PATCH 2/3] sched: code refine in unthrottle_cfs_rq() Michael Wang
2013-06-05 11:15   ` Peter Zijlstra
2013-06-06  2:22     ` Michael Wang
2013-06-06  2:39   ` [PATCH v2 " Michael Wang
2013-06-19 18:39   ` [tip:sched/core] sched: Refine the code " tip-bot for Michael Wang
2013-06-04  6:24 ` [PATCH 3/3] sched: remove the useless declaration in kernel/sched/fair.c Michael Wang
2013-06-05 11:16   ` Peter Zijlstra
2013-06-06  2:39   ` [PATCH v2 " Michael Wang
2013-06-19 18:39   ` [tip:sched/core] sched: Femove the useless declaration in kernel/ sched/fair.c tip-bot for Michael Wang

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=CAPM31RJfWWJuMg-2Byb7uGFQPQY1v+8OWVpwO2Ggz_mtTYpjVQ@mail.gmail.com \
    --to=pjt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=wangyun@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®