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>
This commit is contained in:
Keir Fraser committed 2009-02-05 12:09:10 +00:00
1 parent e0cf17bba6
commit 6dec681bb6
3 files changed
+18 -6

No files matched your search

+10 -6
View File
@@ -399,10 +399,13 @@ static struct page_info *alloc_heap_pages(
/* Reference count must continuously be zero for free pages. */
BUG_ON(pg[i].count_info != 0);
/* Add in any extra CPUs that need flushing because of this page. */
cpus_andnot(extra_cpus_mask, cpu_online_map, mask);
tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);
cpus_or(mask, mask, extra_cpus_mask);
if ( pg[i].u.free.need_tlbflush )
{
/* Add in extra CPUs that need flushing because of this page. */
cpus_andnot(extra_cpus_mask, cpu_online_map, mask);
tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);
cpus_or(mask, mask, extra_cpus_mask);
}
/* Initialise fields which have other uses for free pages. */
pg[i].u.inuse.type_info = 0;
@@ -446,8 +449,9 @@ static void free_heap_pages(
pg[i].count_info = 0;
/* If a page has no owner it will need no safety TLB flush. */
pg[i].tlbflush_timestamp =
page_get_owner(&pg[i]) ? tlbflush_current_time() : 0;
pg[i].u.free.need_tlbflush = (page_get_owner(&pg[i]) != NULL);
if ( pg[i].u.free.need_tlbflush )
pg[i].tlbflush_timestamp = tlbflush_current_time();
}
spin_lock(&heap_lock);
+2
View File
@@ -62,6 +62,8 @@ struct page_info
struct {
/* Order-size of the free chunk this page is the head of. */
u32 order;
/* Do TLBs need flushing for safety before next page use? */
bool_t need_tlbflush;
} free;
} u;
+6
View File
@@ -66,6 +66,12 @@ struct page_info
unsigned long count:26; /* Reference count */
} sh;
/* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
struct {
/* Do TLBs need flushing for safety before next page use? */
bool_t need_tlbflush;
} free;
} u;
union {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.