Re: [patch 00/13] preempt: Make preempt count unconditional
From: Linus Torvalds
Date: Wed Sep 16 2020 - 14:33:08 EST
On Wed, Sep 16, 2020 at 8:29 AM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote:
> All fair, but some of us need to write code that must handle being
> invoked from a wide variety of contexts.
Note that I think that core functionality is different from random drivers.
Of course core code can (and will) look at things like
.. schedule work asynchronously ..
because core code ends up being called from odd places, and code like
that is expected to have understanding of the rules it plays with.
But something like RCU is a very different beast from some "walk the
scatter-gather list" code.
RCU does its work in the background, and works with lots of different
things. And it's so core and used everywhere that it knows about these
things. I mean, we literally have special code explicitly to let RCU
know "we entered kernel context now".
But something like a driver list walking thing should not be doing
different things behind peoples back depending on whether they hold
spinlocks or not. It should either just work regardless, or there
should be a flag (or special interface) for the "you're being called
in a crtitical region".
Because dynamically changing behavior really is very confusing.