From e227045b06d62ee7d2fbab9d5ade9030ff43170b Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 26 Feb 2009 19:11:51 +0000 Subject: 2009-02-26 Samuel Thibault * i386/i386/prog_reg.h (invlpg_linear): Rename macro into... (invlpg_linear_range): ... this. (invlpg_linear): New macro. * i386/intel/pmap.c (INVALIDATE_TLB): Call invlpg_linear instead of flush_tlb when e - S is compile-time known to be PAGE_SIZE, instead of run-time known to be less than 32 * PAGE_SIZE. --- i386/intel/pmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'i386/intel') diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index d46f645..d57df92 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -332,11 +332,14 @@ lock_data_t pmap_system_lock; #define MAX_TBIS_SIZE 32 /* > this -> TBIA */ /* XXX */ #if 0 +/* It is hard to know when a TLB flush becomes less expensive than a bunch of + * invlpgs. But it surely is more expensive than just one invlpg. */ #define INVALIDATE_TLB(s, e) { \ - if (((e) - (s)) > 32 * PAGE_SIZE) \ - flush_tlb(); \ + if (__builtin_constant_p((e) - (s)) + && (e) - (s) == PAGE_SIZE) + invlpg_linear(s); \ else \ - invlpg_linear(s, e); \ + flush_tlb(); \ } #else #define INVALIDATE_TLB(s, e) flush_tlb() -- cgit v1.2.3