Re: drm pull for v5.3-rc1

From: Linus Torvalds
Date: Wed Aug 07 2019 - 15:17:17 EST


On Tue, Aug 6, 2019 at 11:40 PM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> I'm not an all that huge fan of super magic macro loops. But in this
> case I don't see how it could even work, as we get special callbacks
> for huge pages and holes, and people are trying to add a few more ops
> as well.

Yeah, in this case we definitely don't want to make some magic loop walker.

Loops are certainly simpler than callbacks for most cases (and often
faster because you don't have indirect calls which now are getting
quite expensive), but the walker code really does end up having tons
of different cases that you'd have to handle with magic complex
conditionals or switch statements instead.

So the "walk over range using this set of callbacks" is generally the
right interface. If there is some particular case that might be very
simple and the callback model is expensive due to indirect calls for
each page, then such a case should probably use the normal page
walking loops (that we *used* to have everywhere - the "walk_range()"
interface is the "new" model for all the random odd special cases).

Linus