[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200916153928.GA27602@iZj6chx1xj0e0buvshuecpZ>
Date: Wed, 16 Sep 2020 23:39:28 +0800
From: Peng Liu <iwtbavbm@...il.com>
To: Juri Lelli <juri.lelli@...hat.com>
Cc: mingo@...hat.com, peterz@...radead.org, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, valentin.schneider@....com,
raistlin@...ux.it, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched/deadline: Fix sched_dl_global_validate()
On Wed, Sep 16, 2020 at 11:42:03AM +0200, Juri Lelli wrote:
> Hi,
>
> On 15/09/20 23:20, Peng Liu wrote:
> > When user changes sched_rt_{runtime, period}_us, then
> >
> > sched_rt_handler()
> > --> sched_dl_bandwidth_validate()
> > {
> > new_bw = global_rt_runtime()/global_rt_period();
> >
> > for_each_possible_cpu(cpu) {
> > dl_b = dl_bw_of(cpu);
> > if (new_bw < dl_b->total_bw)
> > ret = -EBUSY;
> > }
> > }
> >
> > Under CONFIG_SMP, dl_bw is per root domain , but not per CPU,
> > dl_b->total_bw is the allocated bandwidth of the whole root domain.
> > we should compare dl_b->total_bw against cpus*new_bw, where 'cpus'
> > is the number of CPUs of the root domain.
>
> Hummm, I think you are right. Guess nobody played a lot with changing
> global values. :-/
>
> > Also, below annotation(in kernel/sched/sched.h) implied implementation
> > only appeared in SCHED_DEADLINE v2[1], then deadline scheduler kept
> > evolving till got merged(v9), but the annotation remains unchanged,
> > meaningless and misleading, correct it.
> >
> > * With respect to SMP, the bandwidth is given on a per-CPU basis,
> > * meaning that:
> > * - dl_bw (< 100%) is the bandwidth of the system (group) on each CPU;
> > * - dl_total_bw array contains, in the i-eth element, the currently
> > * allocated bandwidth on the i-eth CPU.
> >
> > [1] https://lkml.org/lkml/2010/2/28/119
> >
> > Signed-off-by: Peng Liu <iwtbavbm@...il.com>
> > ---
> > In fact, I'm not 100% sure that's a bug, since it's too 'obvious' and
> > not newly introduced code.
> >
> > Also, the introduced #ifdef...#endif pairs look ugly, I have no idea
> > how to eliminate them. Ideas and comments are welcome. Thanks.
>
> Can't we just use dl_bw_cpus() ?
>
Oh, good idea, I will have a try. Thanks for your time!
> Thanks,
> Juri
>
Powered by blists - more mailing lists