From: Ben Gras Date: Mon, 1 Aug 2011 13:35:34 +0000 (+0200) Subject: kernel: invlpg facility X-Git-Tag: v3.2.0~372 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/addsub.png?a=commitdiff_plain;h=35cc7fbeb839fa582a0f282bd93cc8f18c749958;p=minix.git kernel: invlpg facility . only use for single-page invalidations initially . shows tiny but statistically significant performance improvement; will be more helpful in certain VM debug modes --- diff --git a/kernel/arch/i386/arch_do_vmctl.c b/kernel/arch/i386/arch_do_vmctl.c index 28461d844..242bf01cd 100644 --- a/kernel/arch/i386/arch_do_vmctl.c +++ b/kernel/arch/i386/arch_do_vmctl.c @@ -61,6 +61,12 @@ struct proc *p; reload_cr3(); return OK; } + case VMCTL_I386_INVLPG: + { + i386_invlpg(m_ptr->SVMCTL_VALUE); + return OK; + } + } diff --git a/kernel/arch/i386/include/arch_proto.h b/kernel/arch/i386/include/arch_proto.h index af605c6ed..145a3d79e 100644 --- a/kernel/arch/i386/include/arch_proto.h +++ b/kernel/arch/i386/include/arch_proto.h @@ -89,6 +89,7 @@ _PROTOTYPE( void phys_outsb, (u16_t port, phys_bytes buf, size_t count) ); _PROTOTYPE( void phys_outsw, (u16_t port, phys_bytes buf, size_t count) ); _PROTOTYPE( u32_t read_cr3, (void) ); _PROTOTYPE( void reload_cr3, (void) ); +_PROTOTYPE( void i386_invlpg, (phys_bytes linaddr) ); _PROTOTYPE( void phys_memset, (phys_bytes ph, u32_t c, phys_bytes bytes)); _PROTOTYPE( void reload_ds, (void) ); _PROTOTYPE( void ia32_msr_read, (u32_t reg, u32_t * hi, u32_t * lo) ); diff --git a/kernel/arch/i386/klib.S b/kernel/arch/i386/klib.S index 561c7e5ea..5f7bcfbb3 100644 --- a/kernel/arch/i386/klib.S +++ b/kernel/arch/i386/klib.S @@ -714,6 +714,18 @@ ENTRY(write_cr3) pop %ebp ret +/*===========================================================================*/ +/* i386_invlpg */ +/*===========================================================================*/ +/* PUBLIC void i386_invlpg(unsigned long linaddr); */ +ENTRY(i386_invlpg) + push %ebp + mov %esp, %ebp + mov 8(%ebp), %eax + invlpg (%eax) + pop %ebp + ret + /*===========================================================================*/ /* getcr3val */ /*===========================================================================*/ diff --git a/servers/vm/arch/i386/pagetable.c b/servers/vm/arch/i386/pagetable.c index bbd2183e9..6bb893b34 100644 --- a/servers/vm/arch/i386/pagetable.c +++ b/servers/vm/arch/i386/pagetable.c @@ -333,8 +333,8 @@ PUBLIC void *vm_allocpage(phys_bytes *phys, int reason) return NULL; } - if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) { - panic("VMCTL_FLUSHTLB failed: %d", r); + if((r=sys_vmctl(SELF, VMCTL_I386_INVLPG, loc)) != OK) { + panic("VMCTL_I386_INVLPG failed: %d", r); } level--; @@ -370,8 +370,8 @@ PUBLIC void vm_pagelock(void *vir, int lockflag) panic("vm_lockpage: pt_writemap failed"); } - if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) { - panic("VMCTL_FLUSHTLB failed: %d", r); + if((r=sys_vmctl(SELF, VMCTL_I386_INVLPG, m)) != OK) { + panic("VMCTL_I386_INVLPG failed: %d", r); } return;