]> git.hungrycats.org Git - linux/commitdiff
Fix threaded user page write memory ordering
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 14 Oct 2004 04:00:06 +0000 (21:00 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 14 Oct 2004 04:00:06 +0000 (21:00 -0700)
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.

include/linux/highmem.h

index 232d8fdb557c85723bc9fa41ad5e3b68f3b46230..7153aef34d5c21dfd21fe9723b698bc0528e631d 100644 (file)
@@ -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)