Re: [PATCH] sched/rt: Slightly optimize 'init_rt_rq()'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 14 Nov 2021 17:16:05 +0100
Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> wrote:

> 'MAX_RT_PRIO' is 100. Instead of clearing bits in 'array->bitmap' one at a
> time, use 'bitmap_clear()' which will do the same but much faster

I don't see this being an improvement as long as we need to keep the loop to
do the initialization of the list head.

> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> ---
> Not sure that this patch is really of any use, but it is the occasion for
> me to spot that there seems to be an off by one in the rt scheduler.
> 
> 'array->bitmap' is MAX_RT_PRIO+1 long. (see [1])
> The last bit seems to be reserved as a sentinel.
> 
> Shouldn't this sentinel, in the code above, be set as:
>   __set_bit(MAX_RT_PRIO + 1, array->bitmap);

No.

The first bit is zero. The last bit in the bitmask is MAX_RT_PRIO. The
bitmask has MAX_RT_PRIO + 1 bits. Your __set_bit() above would be an off by
one error in overwriting the size of the bitmask.

-- Steve



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux