[patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends
Thomas Gleixner
tglx at linutronix.de
Thu Sep 24 06:55:54 AEST 2020
On Wed, Sep 23 2020 at 11:52, Steven Rostedt wrote:
> On Wed, 23 Sep 2020 10:40:32 +0200
> peterz at infradead.org wrote:
>
>> However, with migrate_disable() we can have each task preempted in a
>> migrate_disable() region, worse we can stack them all on the _same_ CPU
>> (super ridiculous odds, sure). And then we end up only able to run one
>> task, with the rest of the CPUs picking their nose.
>
> What if we just made migrate_disable() a local_lock() available for !RT?
>
> I mean make it a priority inheritance PER CPU lock.
>
> That is, no two tasks could do a migrate_disable() on the same CPU? If
> one task does a migrate_disable() and then gets preempted and the
> preempting task does a migrate_disable() on the same CPU, it will block
> and wait for the first task to do a migrate_enable().
>
> No two tasks on the same CPU could enter the migrate_disable() section
> simultaneously, just like no two tasks could enter a preempt_disable()
> section.
>
> In essence, we just allow local_lock() to be used for both RT and !RT.
>
> Perhaps make migrate_disable() an anonymous local_lock()?
>
> This should lower the SHC in theory, if you can't have stacked migrate
> disables on the same CPU.
I'm pretty sure this ends up in locking hell pretty fast and aside of
that it's not working for scenarios like:
kmap_local();
migrate_disable();
...
copy_from_user()
-> #PF
-> schedule()
which brought us into that discussion in the first place. You would stop
any other migrate disable user from running until the page fault is
resolved...
Thanks,
tglx
More information about the Linuxppc-dev
mailing list