Skip to content

Commit

Permalink
powerpc/thp: Use ACCESS_ONCE when loading pmdp
Browse files Browse the repository at this point in the history
We would get wrong results in compiler recomputed old_pmd. Avoid
that by using ACCESS_ONCE

CC: <[email protected]>
Signed-off-by: Aneesh Kumar K.V <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
kvaneesh authored and ozbenh committed Aug 13, 2014
1 parent 969b7b2 commit 7e46724
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/mm/hugepage-hash64.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
* atomically mark the linux large page PMD busy and dirty
*/
do {
old_pmd = pmd_val(*pmdp);
pmd_t pmd = ACCESS_ONCE(*pmdp);

old_pmd = pmd_val(pmd);
/* If PMD busy, retry the access */
if (unlikely(old_pmd & _PAGE_BUSY))
return 0;
Expand Down

0 comments on commit 7e46724

Please sign in to comment.