lkml.org 
[lkml]   [2021]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/rt: Slightly optimize 'init_rt_rq()'
On Sun, 14 Nov 2021 17:16:05 +0100
Christophe JAILLET <christophe.jaillet@wanadoo.fr> 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@wanadoo.fr>
> ---
> 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

\
 
 \ /
  Last update: 2021-11-16 22:53    [W:0.080 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site