summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-13 21:00:06 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-13 21:00:06 -0700
commit538ce05c0ef4055cf29a92a4abcdf139d180a0f9 (patch)
tree93687d3b995290ae48454c7777fc329a03e05ed4 /include/linux
parent8c225dbc5a7b13801a8254aae0ccebab8e4bece7 (diff)
Fix threaded user page write memory ordering
Make sure we order the writes to a newly created page with the page table update that potentially exposes the page to another CPU. This is a no-op on any architecture where getting the page table spinlock will already do the ordering (notably x86), but other architectures can care.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/highmem.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 232d8fdb557c..7153aef34d5c 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -40,6 +40,8 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
void *addr = kmap_atomic(page, KM_USER0);
clear_user_page(addr, vaddr, page);
kunmap_atomic(addr, KM_USER0);
+ /* Make sure this page is cleared on other CPU's too before using it */
+ smp_wmb();
}
static inline void clear_highpage(struct page *page)
@@ -73,6 +75,8 @@ static inline void copy_user_highpage(struct page *to, struct page *from, unsign
copy_user_page(vto, vfrom, vaddr, to);
kunmap_atomic(vfrom, KM_USER0);
kunmap_atomic(vto, KM_USER1);
+ /* Make sure this page is cleared on other CPU's too before using it */
+ smp_wmb();
}
static inline void copy_highpage(struct page *to, struct page *from)