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 <[email protected]>
> > ---
> > 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
> 

Reply via email to