[IA64] Avoid unnecessary TLB flushes when allocating memory
Improve performance of memory allocations on ia64 by avoiding a global TLB purge to purge a single page from the file cache. This happens whenever we evict a page from the buffer cache to make room for some other allocation. Test case: Run 'find /usr -type f | xargs cat > /dev/null' in the background to fill the buffer cache, then run something that uses memory, e.g. 'gmake -j50 install'. Instrumentation showed that the number of global TLB purges went from a few millions down to about 170 over a 12 hours run of the above. The performance impact is particularly noticeable under virtualization, because a virtual TLB is generally both larger and slower to purge than a physical one. Signed-off-by: Christophe de Dinechin <ddd@hp.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
This commit is contained in:
parent
3cdc7fc7fd
commit
aec103bfa6
|
@ -10,6 +10,7 @@
|
||||||
* IPI based ptc implementation and A-step IPI implementation.
|
* IPI based ptc implementation and A-step IPI implementation.
|
||||||
* Rohit Seth <rohit.seth@intel.com>
|
* Rohit Seth <rohit.seth@intel.com>
|
||||||
* Ken Chen <kenneth.w.chen@intel.com>
|
* Ken Chen <kenneth.w.chen@intel.com>
|
||||||
|
* Christophe de Dinechin <ddd@hp.com>: Avoid ptc.e on memory allocation
|
||||||
*/
|
*/
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
@ -89,10 +90,17 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
|
||||||
{
|
{
|
||||||
static DEFINE_SPINLOCK(ptcg_lock);
|
static DEFINE_SPINLOCK(ptcg_lock);
|
||||||
|
|
||||||
if (mm != current->active_mm || !current->mm) {
|
struct mm_struct *active_mm = current->active_mm;
|
||||||
|
|
||||||
|
if (mm != active_mm) {
|
||||||
|
/* Restore region IDs for mm */
|
||||||
|
if (mm && active_mm) {
|
||||||
|
activate_context(mm);
|
||||||
|
} else {
|
||||||
flush_tlb_all();
|
flush_tlb_all();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* HW requires global serialization of ptc.ga. */
|
/* HW requires global serialization of ptc.ga. */
|
||||||
spin_lock(&ptcg_lock);
|
spin_lock(&ptcg_lock);
|
||||||
|
@ -107,6 +115,10 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
|
||||||
} while (start < end);
|
} while (start < end);
|
||||||
}
|
}
|
||||||
spin_unlock(&ptcg_lock);
|
spin_unlock(&ptcg_lock);
|
||||||
|
|
||||||
|
if (mm != active_mm) {
|
||||||
|
activate_context(active_mm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue