Re: [PATCH v2] selftests/mm: use global variable to not optimize mmap read variable

From: Zi Yan
Date: Thu Jun 06 2024 - 11:47:54 EST


On 6 Jun 2024, at 8:44, Pankaj Raghav (Samsung) wrote:

> From: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
>
> create_pagecache_thp_and_fd() in split_huge_page_test.c used the
> variable dummy to perform mmap read.
>
> However, this test was skipped even on XFS which has large folio
> support. The issue was compiler (gcc 13.2.0) was optimizing out the
> dummy variable, therefore, not creating huge page in the page cache.
>
> Make it as a global variable to force the compiler not to optimize out
> the loop where we read from the mmaped addr.
>
> Signed-off-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
> ---
> Changes since v1:
> - Make the dummy variable as a global variable(willy).
>
> tools/testing/selftests/mm/split_huge_page_test.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>

Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>

Thanks.

Best Regards,
Yan, Zi

Attachment: signature.asc
Description: OpenPGP digital signature