page_alloc: Hold heap_lock while adjusting page states to/from PGC_state_free.

This avoids races with buddy-merging logic in free_heap_pages().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
This commit is contained in:
Keir Fraser committed 2010-09-13 17:08:31 +01:00
1 parent 8462487d48
commit 8b8b7e6c90
1 file changed
+4 -4
+4 -4
View File
@@ -415,8 +415,6 @@ static struct page_info *alloc_heap_pages(
if ( d != NULL )
d->last_alloc_node = node;
spin_unlock(&heap_lock);
cpus_clear(mask);
for ( i = 0; i < (1 << order); i++ )
@@ -438,6 +436,8 @@ static struct page_info *alloc_heap_pages(
page_set_owner(&pg[i], NULL);
}
spin_unlock(&heap_lock);
if ( unlikely(!cpus_empty(mask)) )
{
perfc_incr(need_flush_tlb_flush);
@@ -533,6 +533,8 @@ static void free_heap_pages(
ASSERT(order <= MAX_ORDER);
ASSERT(node >= 0);
spin_lock(&heap_lock);
for ( i = 0; i < (1 << order); i++ )
{
/*
@@ -560,8 +562,6 @@ static void free_heap_pages(
pg[i].tlbflush_timestamp = tlbflush_current_time();
}
spin_lock(&heap_lock);
avail[node][zone] += 1 << order;
total_avail_pages += 1 << order;
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.