drm pull for v5.3-rc1

Linus Torvalds torvalds at linux-foundation.org
Mon Jul 15 22:17:42 UTC 2019


On Mon, Jul 15, 2019 at 1:07 PM Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> The mm_walk struct is indeed a bit similar, and is in fact a bit
> problematic exactly because it mixes function pointers with non-const
> data.

This made me look at how nasty that would be to fix.

Not too bad.

The attached patch does add more lines than it removes, but in most
cases it's actually a clear improvement.

It results in:

 - smaller stackframes and less runtime initialization: the bulk of
the 'mm_walk' structure was the ops pointers, and if we split them out
and make them const, we can just initialize them statically, and the
stack footprint now becomes just a single word.

 - the function pointers are now nicely in a const data section

in addition to the whole "don't mix variable data with constants, and
don't put function pointers on the stack" thing.

Of course, I haven't _tested_ the end result, but since it compiles it
must be perfect, right? Not that I tested all of the build either,
since several of the mm_walk users were for other architectures.

I'm not sure this is really worth it, but I'm throwing the patch out
there in case somebody wants to look.

Andrew, comments? I don't think we have anybody who is in charge of
mm_walk outside of you...

                  Linus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 21678 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190715/a1f7cb92/attachment-0001.bin>


More information about the dri-devel mailing list