ppc/hugetlbfs: Replace ACCESS_ONCE with READ_ONCE
authorChristian Borntraeger <borntraeger@de.ibm.com>
Tue, 6 Jan 2015 21:47:41 +0000 (22:47 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 19 Jan 2015 13:14:19 +0000 (14:14 +0100)
ACCESS_ONCE does not work reliably on non-scalar types. For
example gcc 4.6 and 4.7 might remove the volatile tag for such
accesses during the SRA (scalar replacement of aggregates) step
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145)

Change the ppc/hugetlbfs code to replace ACCESS_ONCE with READ_ONCE.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/powerpc/mm/hugetlbpage.c

index 5ff4e07d920a365a7860df9bba0afc33c82b442a..620d0ec93e6f98711af13165374eba26eae50d28 100644 (file)
@@ -978,7 +978,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift
                 */
                pdshift = PUD_SHIFT;
                pudp = pud_offset(&pgd, ea);
-               pud  = ACCESS_ONCE(*pudp);
+               pud  = READ_ONCE(*pudp);
 
                if (pud_none(pud))
                        return NULL;
@@ -990,7 +990,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift
                else {
                        pdshift = PMD_SHIFT;
                        pmdp = pmd_offset(&pud, ea);
-                       pmd  = ACCESS_ONCE(*pmdp);
+                       pmd  = READ_ONCE(*pmdp);
                        /*
                         * A hugepage collapse is captured by pmd_none, because
                         * it mark the pmd none and do a hpte invalidate.