ia64/xen-unstable
changeset 18739:19549b9766fd
x86: Fix circular page reference destruction in relinquish_memory().
Tested by Jan Beulich and fixes a memory leak, but there is more to be
done here.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Tested by Jan Beulich and fixes a memory leak, but there is more to be
done here.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Oct 28 11:25:20 2008 +0000 (2008-10-28) |
parents | 2c20d026bb55 |
children | 2c7665f04038 |
files | xen/arch/x86/domain.c xen/arch/x86/mm.c |
line diff
1.1 --- a/xen/arch/x86/domain.c Tue Oct 28 10:37:30 2008 +0000 1.2 +++ b/xen/arch/x86/domain.c Tue Oct 28 11:25:20 2008 +0000 1.3 @@ -1687,7 +1687,6 @@ static int relinquish_memory( 1.4 { 1.5 if ( free_page_type(page, x, 0) != 0 ) 1.6 BUG(); 1.7 - put_page(page); 1.8 break; 1.9 } 1.10 }
2.1 --- a/xen/arch/x86/mm.c Tue Oct 28 10:37:30 2008 +0000 2.2 +++ b/xen/arch/x86/mm.c Tue Oct 28 11:25:20 2008 +0000 2.3 @@ -1973,6 +1973,7 @@ int free_page_type(struct page_info *pag 2.4 page->nr_validated_ptes = 1U << PAGETABLE_ORDER; 2.5 page->partial_pte = 0; 2.6 } 2.7 + 2.8 switch ( type & PGT_type_mask ) 2.9 { 2.10 case PGT_l1_page_table: 2.11 @@ -1998,6 +1999,15 @@ int free_page_type(struct page_info *pag 2.12 BUG(); 2.13 } 2.14 2.15 + return rc; 2.16 +} 2.17 + 2.18 + 2.19 +static int __put_final_page_type( 2.20 + struct page_info *page, unsigned long type, int preemptible) 2.21 +{ 2.22 + int rc = free_page_type(page, type, preemptible); 2.23 + 2.24 /* No need for atomic update of type_info here: noone else updates it. */ 2.25 if ( rc == 0 ) 2.26 { 2.27 @@ -2062,7 +2072,7 @@ static int __put_page_type(struct page_i 2.28 x, nx)) != x) ) 2.29 continue; 2.30 /* We cleared the 'valid bit' so we do the clean up. */ 2.31 - return free_page_type(page, x, preemptible); 2.32 + return __put_final_page_type(page, x, preemptible); 2.33 } 2.34 2.35 /*