Re: [PATCH 0/3] mm: treewide: make get_free_pages() and return void *
From: Matthew Wilcox
Date: Sat Oct 18 2025 - 20:31:27 EST
On Sat, Oct 18, 2025 at 12:29:59PM +0300, Mike Rapoport wrote:
> Vast majority of allocations that use get_free_pages() and its derivatives
> cast the returned unsigned long to a pointer and then cast it back to
> unsigned long when freeing the memory.
>
> These castings are useless and only obfuscate the code.
>
> Make get_free_pages() and friends return 'void *' and free_pages() accept
> 'void *' as its address parameter.
No. Linus has rejected this change before. I can't find it now, it was
a long time ago. Most of them shouldn't be using get_free_pages() at
all, they should be using kmalloc().