On 22/01/2026 5:02 pm, Kevin Brodsky wrote:
One of the pagemap_ioctl tests attempts to fault in pages by
memcpy()'ing them to an unused buffer. This probably worked
originally, but since commit 46036188ea1f ("selftests/mm: build with
-O2") the compiler is free to optimise away that unused buffer and
the memcpy() with it. As a result there might not be any resident
page in the mapping and the test may fail.

We don't need to copy all that memory anyway. Just fault in every
page.

While at it also make sure to compute the number of pages once using
simple integer arithmetic instead of ceilf() and implicit
conversions.

Fixes: 46036188ea1f ("selftests/mm: build with -O2")
Cc: Usama Anjum <[email protected]>
Acked-by: David Hildenbrand (Red Hat) <[email protected]>
Reviewed-by: Dev Jain <[email protected]>
Signed-off-by: Kevin Brodsky <[email protected]>
---
Reviewed-by: Muhammad Usama Anjum <[email protected]>



Reply via email to