Re: [PATCH RFC v4 2/3] sched: Avoid placing RT threads on cores handling long softirqs

From: John Stultz
Date: Tue Oct 18 2022 - 01:32:36 EST


On Mon, Oct 17, 2022 at 8:42 PM John Stultz <jstultz@xxxxxxxxxx> wrote:
> On Mon, Oct 17, 2022 at 5:40 AM Alexander Gordeev
> <agordeev@xxxxxxxxxxxxx> wrote:
> > On Mon, Oct 03, 2022 at 11:20:32PM +0000, John Stultz wrote:
> > > + preempt_count() & SOFTIRQ_MASK);
> >
> > Could you please clarify this whole check in more detail?
> >
> > What is the point in checking if a remote CPU is handling
> > a "long" softirq while the local one is handling any softirq?
>
> Good question! This looks like an error from my rework of the earlier
> version of the patch.
> In v1 it was:
> task_thread_info(curr)->preempt_count & SOFTIRQ_MASK));
> And it looks like I erroneously condensed that to preempt_count() &
> SOFTIRQ_MASK treating curr (from the target cpu rq) as if it were
> current. :P
>
> I'll fix this. Thank you for catching it!

Ah, it's not so trivial to fix as I see part of my motivation for
condensing it was task_thread_info(curr)->preempt_count doesn't build
on x86 (which uses percpu values instead of threadinfo).

So I'll have to think a bit more about how to do this generically, and
if the conditionalization can be otherwise simplified.

Thanks again for pointing the issue out!
-john