ia64/xen-unstable

changeset 19166:416197f0292b

Add a page_info flag to indicate whether free pages need a TLB flush
on next use.

Apart from teh small performance gain of this, my primary motivation
is to avoid TLB flushes very early in boot, when the system is not yet
properly set up for cross-TLB shootdowns.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 05 12:09:10 2009 +0000 (2009-02-05)
parents 3fc7d4115d6c
children 5fd1a6951801
files xen/common/page_alloc.c xen/include/asm-ia64/mm.h xen/include/asm-x86/mm.h
line diff
     1.1 --- a/xen/common/page_alloc.c	Thu Feb 05 08:28:00 2009 +0000
     1.2 +++ b/xen/common/page_alloc.c	Thu Feb 05 12:09:10 2009 +0000
     1.3 @@ -399,10 +399,13 @@ static struct page_info *alloc_heap_page
     1.4          /* Reference count must continuously be zero for free pages. */
     1.5          BUG_ON(pg[i].count_info != 0);
     1.6  
     1.7 -        /* Add in any extra CPUs that need flushing because of this page. */
     1.8 -        cpus_andnot(extra_cpus_mask, cpu_online_map, mask);
     1.9 -        tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);
    1.10 -        cpus_or(mask, mask, extra_cpus_mask);
    1.11 +        if ( pg[i].u.free.need_tlbflush )
    1.12 +        {
    1.13 +            /* Add in extra CPUs that need flushing because of this page. */
    1.14 +            cpus_andnot(extra_cpus_mask, cpu_online_map, mask);
    1.15 +            tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);
    1.16 +            cpus_or(mask, mask, extra_cpus_mask);
    1.17 +        }
    1.18  
    1.19          /* Initialise fields which have other uses for free pages. */
    1.20          pg[i].u.inuse.type_info = 0;
    1.21 @@ -446,8 +449,9 @@ static void free_heap_pages(
    1.22          pg[i].count_info = 0;
    1.23  
    1.24          /* If a page has no owner it will need no safety TLB flush. */
    1.25 -        pg[i].tlbflush_timestamp =
    1.26 -            page_get_owner(&pg[i]) ? tlbflush_current_time() : 0;
    1.27 +        pg[i].u.free.need_tlbflush = (page_get_owner(&pg[i]) != NULL);
    1.28 +        if ( pg[i].u.free.need_tlbflush )
    1.29 +            pg[i].tlbflush_timestamp = tlbflush_current_time();
    1.30      }
    1.31  
    1.32      spin_lock(&heap_lock);
     2.1 --- a/xen/include/asm-ia64/mm.h	Thu Feb 05 08:28:00 2009 +0000
     2.2 +++ b/xen/include/asm-ia64/mm.h	Thu Feb 05 12:09:10 2009 +0000
     2.3 @@ -62,6 +62,8 @@ struct page_info
     2.4          struct {
     2.5              /* Order-size of the free chunk this page is the head of. */
     2.6              u32 order;
     2.7 +            /* Do TLBs need flushing for safety before next page use? */
     2.8 +            bool_t need_tlbflush;
     2.9          } free;
    2.10  
    2.11      } u;
     3.1 --- a/xen/include/asm-x86/mm.h	Thu Feb 05 08:28:00 2009 +0000
     3.2 +++ b/xen/include/asm-x86/mm.h	Thu Feb 05 12:09:10 2009 +0000
     3.3 @@ -66,6 +66,12 @@ struct page_info
     3.4              unsigned long count:26; /* Reference count */
     3.5          } sh;
     3.6  
     3.7 +        /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
     3.8 +        struct {
     3.9 +            /* Do TLBs need flushing for safety before next page use? */
    3.10 +            bool_t need_tlbflush;
    3.11 +        } free;
    3.12 +
    3.13      } u;
    3.14  
    3.15      union {