[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878r8wgg3b.ffs@tglx>
Date: Sun, 24 Sep 2023 09:55:52 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Matthew Wilcox <willy@...radead.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Ankur Arora <ankur.a.arora@...cle.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org, x86@...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, mgorman@...e.de,
rostedt@...dmis.org, jon.grimm@....com, bharata@....com,
raghavendra.kt@....com, boris.ostrovsky@...cle.com,
konrad.wilk@...cle.com, jgross@...e.com, andrew.cooper3@...rix.com
Subject: Re: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED
On Sun, Sep 24 2023 at 08:19, Matthew Wilcox wrote:
> On Sun, Sep 24, 2023 at 12:50:43AM +0200, Thomas Gleixner wrote:
>> cond_resched() cannot nest and is obviously scope-less.
>>
>> The TIF_ALLOW_RESCHED mechanism, which sparked this discussion only
>> pretends to be scoped.
>>
>> As Peter pointed out it does not properly nest with other mechanisms and
>> it cannot even nest in itself because it is boolean.
>
> We can nest a single bit without turning it into a counter -- we
> do this for memalloc_nofs_save() for example. Simply return the
> current value of the bit, and pass it to _restore().
Right.
That works, but the reverse logic still does not make sense:
allow_resched();
....
spin_lock();
while
resched_now_is_suboptimal();
...
spin_lock();
works.
Thanks,
tglx
Powered by blists - more mailing lists