sparc: tsb must be flushed before tlb
authorDave Kleikamp <dave.kleikamp@oracle.com>
Tue, 18 Jun 2013 14:05:36 +0000 (09:05 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Jun 2013 09:10:30 +0000 (02:10 -0700)
This fixes a race where a cpu may re-load a tlb from a stale tsb right
after it has been flushed by a remote function call.

I still see some instability when stressing the system with parallel
kernel builds while creating memory pressure by writing to
/proc/sys/vm/nr_hugepages, but this patch improves the stability
significantly.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Acked-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/mm/tlb.c

index 83d89bcb44afcace24b757b02ce5305c1e762afe..37e7bc4c95b373aad3c9dbac1f16fe172b205890 100644 (file)
@@ -85,8 +85,8 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
        }
 
        if (!tb->active) {
-               global_flush_tlb_page(mm, vaddr);
                flush_tsb_user_page(mm, vaddr);
+               global_flush_tlb_page(mm, vaddr);
                goto out;
        }