[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211116165137.35d06251@gandalf.local.home>
Date: Tue, 16 Nov 2021 16:51:37 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] sched/rt: Slightly optimize 'init_rt_rq()'
On Sun, 14 Nov 2021 17:16:05 +0100
Christophe JAILLET <christophe.jaillet@...adoo.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@...adoo.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
Powered by blists - more mailing lists