Skip to content

Commit 939de63

Browse files
MiaoheLinakpm00
authored andcommitted
mm: hugetlb_vmemmap: add missing smp_wmb() before set_pte_at()
The memory barrier smp_wmb() is needed to make sure that preceding stores to the page contents become visible before the below set_pte_at() write. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Miaohe Lin <[email protected]> Reviewed-by: Yin Fengwei <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3a5497a commit 939de63

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mm/hugetlb_vmemmap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ static void vmemmap_restore_pte(pte_t *pte, unsigned long addr,
287287
copy_page(to, (void *)walk->reuse_addr);
288288
reset_struct_pages(to);
289289

290+
/*
291+
* Makes sure that preceding stores to the page contents become visible
292+
* before the set_pte_at() write.
293+
*/
294+
smp_wmb();
290295
set_pte_at(&init_mm, addr, pte, mk_pte(page, pgprot));
291296
}
292297

0 commit comments

Comments
 (0)