Re: [PATCH v3] selftests/mm: use asm volatile to not optimize mmap read variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 Jun 2024, at 13:36, 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.
>
> Use asm volatile() trick to force the compiler not to optimize out
> the loop where we read from the mmaped addr. This is similar to what is
> being done in other tests (cow.c, etc)
>
> As the variable is now used in the asm statement, remove the unused
> attribute.
>
> Signed-off-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
> ---
> Changes since v2:
> - Use the asm volatile trick to force the compiler to not optimize the
>   read into dummy variable. (David)
>
>  tools/testing/selftests/mm/split_huge_page_test.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
LGTM. Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>

Best Regards,
Yan, Zi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux