[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v86k8opr.ffs@tglx>
Date: Mon, 19 Feb 2024 16:21:04 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Mark Rutland <mark.rutland@....com>, Ankur Arora <ankur.a.arora@...cle.com>
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, 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, Arnd Bergmann
<arnd@...db.de>, "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH 03/30] thread_info: tif_need_resched() now takes
resched_t as param
On Wed, Feb 14 2024 at 14:08, Mark Rutland wrote:
> On Mon, Feb 12, 2024 at 09:55:27PM -0800, Ankur Arora wrote:
>>
>> -static __always_inline bool tif_need_resched(void)
>> +static __always_inline bool __tif_need_resched(int nr_flag)
>> {
>> - return test_bit(TIF_NEED_RESCHED,
>> - (unsigned long *)(¤t_thread_info()->flags));
>> + return test_bit(nr_flag,
>> + (unsigned long *)(¤t_thread_info()->flags));
>> }
>>
>> #endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_ATOMIC_H */
>>
>> +static __always_inline bool tif_need_resched(resched_t rs)
>> +{
>> + /*
>> + * With !PREEMPT_AUTO tif_need_resched(NR_lazy) is defined
>> + * as TIF_NEED_RESCHED (the TIF_NEED_RESCHED_LAZY flag is not
>> + * defined). Return false in that case.
>> + */
>> + if (IS_ENABLED(CONFIG_PREEMPT_AUTO) || rs == NR_now)
>> + return __tif_need_resched(tif_resched(rs));
>> + else
>> + return false;
>> +}
>
> As above, I think this would be a bit simpler/clearer if we did:
>
> static __always_inline bool tif_need_resched_now(void)
> {
> return __tif_need_resched(TIF_NEED_RESCHED);
> }
>
> static __always_inline bool tif_need_resched_lazy(void)
> {
> return IS_ENABLED(CONFIG_PREEMPT_AUTO) &&
> __tif_need_resched(TIF_NEED_RESCHED_LAZY);
> }
Yes please.
Powered by blists - more mailing lists