[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87msruiwz6.fsf@oracle.com>
Date: Tue, 20 Feb 2024 14:37:01 -0800
From: Ankur Arora <ankur.a.arora@...cle.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org,
torvalds@...ux-foundation.org, paulmck@...nel.org,
akpm@...ux-foundation.org, luto@...nel.org, bp@...en8.de,
dave.hansen@...ux.intel.com, hpa@...or.com, mingo@...hat.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org, willy@...radead.org,
mgorman@...e.de, jpoimboe@...nel.org, mark.rutland@....com,
jgross@...e.com, andrew.cooper3@...rix.com, bristot@...nel.org,
mathieu.desnoyers@...icios.com, geert@...ux-m68k.org,
glaubitz@...sik.fu-berlin.de, anton.ivanov@...bridgegreys.com,
mattst88@...il.com, krypton@...ich-teichert.org, rostedt@...dmis.org,
David.Laight@...LAB.COM, richard@....at, mjguzik@...il.com,
jon.grimm@....com, bharata@....com, raghavendra.kt@....com,
boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
Ankur Arora
<ankur.a.arora@...cle.com>
Subject: Re: [PATCH 05/30] sched: *_tsk_need_resched() now takes resched_t
as param
Thomas Gleixner <tglx@...utronix.de> writes:
> On Mon, Feb 12 2024 at 21:55, Ankur Arora wrote:
>
> The subject line reads odd...
>
>> -static inline bool test_tsk_need_resched(struct task_struct *tsk)
>> +static inline bool test_tsk_need_resched(struct task_struct *tsk, resched_t rs)
>> {
>> - return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
>> + if (IS_ENABLED(CONFIG_PREEMPT_AUTO) || rs == NR_now)
>> + return unlikely(test_tsk_thread_flag(tsk, tif_resched(rs)));
>> + else
>> + return false;
>> }
>
> Same like the others. This wants wrappers with now/lazy.
So, when working on the scheduler changes, I found the simplest
implementation was to define a function that takes into account
current preemption mode, checks for idle, tick etc and returns
the rescheduling policy, which __resched_curr() carries out.
So, it would be useful to just pass the resched_t as a parameter
instead of having now/lazy wrappers.
That said, as I mention in the other thread, the current primitives
are unnecessarily noisy because everyone needs to use it.
-static inline bool test_tsk_need_resched(struct task_struct *tsk, resched_t rs)
+static inline bool __test_tsk_need_resched(struct task_struct *tsk, resched_t rs)
{
if (IS_ENABLED(CONFIG_PREEMPT_AUTO) || rs == NR_now)
return unlikely(test_tsk_thread_flag(tsk, tif_resched(rs)));
@@ -1980,6 +1985,11 @@ static inline bool test_tsk_need_resched(struct task_struct *tsk, resched_t rs)
return false;
}
+static inline bool test_tsk_need_resched(struct task_struct *tsk)
+{
+ return __test_tsk_need_resched(tsk, NR_now);
+}
+
How about something like this (and similar elsewhere)?
>> /*
>> @@ -2104,7 +2121,8 @@ static __always_inline bool need_resched(void)
>>
>> static __always_inline bool need_resched_lazy(void)
>> {
>> - return unlikely(tif_need_resched(NR_lazy));
>> + return IS_ENABLED(CONFIG_PREEMPT_AUTO) &&
>> + unlikely(tif_need_resched(NR_lazy));
>
> Shouldn't this be folded into the patch which adds need_resched_lazy()?
I think I had messed up a rebase. Will fix.
Thanks
--
ankur
Powered by blists - more mailing lists