[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtAb1byoZRJZPfvGGgQBEVDCNya3tC6NF83v0khiGV9dDw@mail.gmail.com>
Date: Tue, 2 Apr 2013 16:38:51 +0200
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Alex Shi <alex.shi@...el.com>
Cc: "mingo@...hat.com" <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Borislav Petkov <bp@...en8.de>, Paul Turner <pjt@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Mike Galbraith <efault@....de>, gregkh@...uxfoundation.org,
Preeti U Murthy <preeti@...ux.vnet.ibm.com>,
Viresh Kumar <viresh.kumar@...aro.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [patch v6 10/21] sched: get rq potential maximum utilization
On 30 March 2013 15:34, Alex Shi <alex.shi@...el.com> wrote:
> Since the rt task priority is higher than fair tasks, cfs_rq utilization
> is just the left of rt utilization.
>
> When there are some cfs tasks in queue, the potential utilization may
> be yielded, so mulitiplying cfs task number to get max potential
> utilization of cfs. Then the rq utilization is sum of rt util and cfs
> util.
>
> Signed-off-by: Alex Shi <alex.shi@...el.com>
> ---
> kernel/sched/fair.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ae87dab..0feeaee 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3350,6 +3350,22 @@ struct sg_lb_stats {
> unsigned int group_util; /* sum utilization of group */
> };
>
> +static unsigned long scale_rt_util(int cpu);
> +
> +static unsigned int max_rq_util(int cpu)
> +{
> + struct rq *rq = cpu_rq(cpu);
> + unsigned int rt_util = scale_rt_util(cpu);
> + unsigned int cfs_util;
> + unsigned int nr_running;
> +
> + cfs_util = (FULL_UTIL - rt_util) > rq->util ? rq->util
> + : (FULL_UTIL - rt_util);
rt_util and rq->util don't use the same computation algorithm so the
results are hardly comparable or addable. In addition, some RT tasks
can have impacted the rq->util, so they will be accounted in both
side.
Vincent
> + nr_running = rq->nr_running ? rq->nr_running : 1;
> +
> + return rt_util + cfs_util * nr_running;
> +}
> +
> /*
> * sched_balance_self: balance the current task (running on cpu) in domains
> * that have the 'flag' flag set. In practice, this is SD_BALANCE_FORK and
> --
> 1.7.12
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists