[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0a54f02-bee3-41b8-8c4f-9cfd7ea524ed@redhat.com>
Date: Fri, 9 May 2025 12:43:49 +0200
From: David Hildenbrand <david@...hat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
Shuah Khan <shuah@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH v1] selftests/mm: add simple VM_PFNMAP tests based on
mmap'ing /dev/mem
>> Is this not pretty much equivalent to a volatile read where you're forcing
>> the compiler to not optimise this unused thing away? In guard-regions I set:
>>
>> #define FORCE_READ(x) (*(volatile typeof(x) *)x)
>>
>> For this purpose, which would make this:
>>
>> FORCE_READ(addr);
>> FORCE_READ(&addr[pagesize]);
>
> Hmmm, a compiler might be allowed to optimize out a volatile read.
Looking into this, the compiler should not be allowed to do that. So
FORCE_READ() should work!
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists