[patch] __flush_one_page() on i386

Andrea Arcangeli (andrea@suse.de)
Thu, 16 Sep 1999 14:01:52 +0200 (CEST)


On i386 we are doing a flush_tlb_current_task() when a __flush_one_page()
is requested. This is plain wrong as if there isn't the `invlpg` asm
instruction we should revert to the only bit more larger (and CPU local)
operation by moving back and forth the %%cr3 register so doing a full
flush of the local tlb and nothing more.

This bug is on both 2.2.x and 2.3.x.

In 2.3.18 __flush_one_page() actually is called by flush_tlb_page() in
smp.c and flush_tlb_page is called by kswapd. kswapd has no current->mm so
then flush_tlb_current_page() oopses because current->mm is null and it's
trying to dereference it to flush the mm of the current (kswapd) task.

Fix against 2.3.18ac4:

--- 2.3.18ac4-tlb/include/asm-i386/pgtable.h.~1~ Wed Sep 15 14:48:32 1999
+++ 2.3.18ac4-tlb/include/asm-i386/pgtable.h Wed Sep 15 15:47:41 1999
@@ -44,7 +44,7 @@
do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3":"=r" (tmpreg) : :"memory"); } while (0)

#ifndef CONFIG_X86_INVLPG
-#define __flush_tlb_one(addr) flush_tlb()
+#define __flush_tlb_one(addr) __flush_tlb()
#else
#define __flush_tlb_one(addr) \
__asm__ __volatile__("invlpg %0": :"m" (*(char *) addr))

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/