On 19/01/2026 12:09, David Hildenbrand (Red Hat) wrote:
> On 1/7/26 17:48, 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.
>
> Yes, I assume so. Using FORCE_READ() etc is the way to go.
>
>
> Should we add
>
> Fixes: 46036188ea1f ("selftests/mm: build with -O2")
Yes that seems reasonable, the test was arguably broken to start with
but it is this commit that revealed it ;)
- Kevin