On Wed, Oct 15, 2025 at 01:31:21AM -0400, Pasha Tatashin wrote:
> -     elm = kzalloc(sz, GFP_KERNEL);
> +     order = get_order(sz);
> +     elm = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
>       if (!elm)
>               return ERR_PTR(-ENOMEM);

Please add a function to allocate preservable non-scratch pages then
:\ I don't think we should be sprinkling __get_free_pages() all over
the place.

You can then add a cleanup.h for the new function and so on.

It should allocate frozen pages, accept a size_t and return a void *.

If this issue is only related to kfence then the new function could
have an if IS_ENABLED(KFENCE) and use slab when it is safe.

Jason

Reply via email to