Re: [PATCH] mm/cma: move put_page_testzero() out of VM_WARN_ON in cma_release()

From: Zi Yan

Date: Tue Feb 24 2026 - 21:20:16 EST


On 24 Feb 2026, at 16:39, Zi Yan wrote:

> When CONFIG_DEBUG_VM is not set, VM_WARN_ON is a NOP. Putting any statement
> with side effect inside it is incorrect. Move put_page_testzero() out and
> check its return value in VM_WARN_ON. Add __maybe_unused to the return
> value for when CONFIG_DEBUG_VM is not set.
>
> Fixes: 9bda131c6093 ("mm: cma: add cma_alloc_frozen{_compound}()")
> Reported-by: Ron Economos <re@xxxxxxxx>
> Closes: https://lore.kernel.org/all/1b17c38f-30d3-4bb4-a7e1-e74b19ada885@xxxxxxxx/
> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
> ---
> Alternatively, we can use WARN_ON instead. Let me know.
>
> mm/cma.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>

Kefeng suggested a better solution[1]. Will update this one soon.

[1] https://lore.kernel.org/all/4b219cd0-9391-4edb-83c0-b6a1c60d0790@xxxxxxxxxx

Best Regards,
Yan, Zi