WriteThrough pageclearing, 2.1.50, anyone with a PPro?

Ingo Molnar (mingo@pc7537.hil.siemens.at)
Fri, 15 Aug 1997 09:53:34 +0200 (MET DST)


could someone with a PPro give this patch a try? Maybe it shows up in some
of the lmbench numbers [lat_proc?]. It does pageclearing with WT caching
logic, which prevents PPro write-allocate L1 cache tactics, less L1 cache
trashing, hopefully. I have only P5 systems to test here. [the patch
works, but shows no effect obviously]

you'll need 2.1.50 for this.

-- mingo

--- linux/include/asm-i386/.page.h.original Tue Oct 15 07:14:53 1996
+++ linux/include/asm-i386/page.h Wed Aug 13 00:11:20 1997
@@ -10,7 +10,8 @@

#define STRICT_MM_TYPECHECKS

-#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
+extern void __clear_page(void * page);
+#define clear_page(page) __clear_page((void *)(page))
#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)

#ifdef STRICT_MM_TYPECHECKS
--- linux/arch/i386/mm/.ioremap.c.original Tue Aug 12 21:38:26 1997
+++ linux/arch/i386/mm/ioremap.c Wed Aug 13 00:01:13 1997
@@ -10,6 +10,9 @@

#include <linux/vmalloc.h>
#include <asm/io.h>
+#include <asm/smp.h>
+#include <asm/smp_lock.h>
+#include <asm/hardirq.h>

static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
unsigned long phys_addr, unsigned long flags)
@@ -113,3 +116,42 @@
if (addr > high_memory)
return vfree(addr);
}
+
+/*
+ * FIXME: make this use vmalloc() to get a window instead.
+ */
+static unsigned long magic_window = 0xd8000000;
+static pte_t * magic_pte = NULL;
+
+void init_zeroing_window (void)
+{
+ pgd_t * dir;
+ pmd_t *pmd;
+
+ printk("mapping magic window ...");
+
+ dir = pgd_offset(&init_mm, magic_window);
+ pmd = pmd_alloc_kernel(dir, magic_window);
+ magic_pte = pte_alloc_kernel(pmd, magic_window);
+
+ printk(" done.\n");
+}
+
+void __clear_page (void * address)
+{
+ if (!magic_pte) {
+ /* FIXME */
+ memset(address, 0, PAGE_SIZE);
+ return;
+ }
+
+ if (local_irq_count[smp_processor_id()])
+ panic("mingo sucks, implement stacking ...");
+
+ set_pte(magic_pte, mk_pte(address, __pgprot(_PAGE_PRESENT |
+ _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_WT )));
+ __flush_tlb_one(magic_window);
+ memset((void *)magic_window, 0, PAGE_SIZE);
+}
+
+
--- .main.c.original Tue Aug 5 16:58:55 1997
+++ main.c Tue Aug 12 22:47:45 1997
@@ -921,6 +921,7 @@
#ifdef CONFIG_SYSCTL
sysctl_init();
#endif
+ init_zeroing_window();
/*
* We count on the initial thread going ok
* Like idlers init is an unlocked kernel thread, which will