Re: [RFC PATCH 1/8] mm: Switch mm->get_unmapped_area() to a flag

From: Dave Hansen
Date: Thu Feb 15 2024 - 19:30:55 EST


On 2/15/24 15:13, Rick Edgecombe wrote:
> The mm_struct contains a function pointer *get_unmapped_area(), which
> is set to either arch_get_unmapped_area() or
> arch_get_unmapped_area_topdown() during the initialization of the mm.
>
> Since the function pointer only ever points to two functions that are named
> the same across all arch's, a function pointer is not really required. In
> addition future changes will want to add versions of the functions that
> take additional arguments. So to save a pointers worth of bytes in
> mm_struct, and prevent adding additional function pointers to mm_struct in
> future changes, remove it and keep the information about which
> get_unmapped_area() to use in a flag.

Indirect calls are just all kinds of evil, especially when Spectre-v2 is
in play. This is a really good idea.

Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>