[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/page_alloc: Don't hold the heap_lock when clearing PGC_need_scrub
commit 025eacc13f6147ffa99da5ecee4ed96e7fe8e887 Author: Julien Grall <jgrall@xxxxxxxxxx> AuthorDate: Thu Jan 21 11:12:00 2021 +0000 Commit: Julien Grall <jgrall@xxxxxxxxxx> CommitDate: Wed Apr 7 19:30:55 2021 +0100 xen/page_alloc: Don't hold the heap_lock when clearing PGC_need_scrub Currently, the heap_lock is held when clearing PGC_need_scrub in alloc_heap_pages(). However, this is unnecessary because the only caller (mark_page_offline()) that can concurrently modify the count_info is using cmpxchg() in a loop. Therefore, rework the code to avoid holding the heap_lock and use test_and_clear_bit() instead. Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/common/page_alloc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 1744e6faa5..ace6333c18 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1032,16 +1032,12 @@ static struct page_info *alloc_heap_pages( { for ( i = 0; i < (1U << order); i++ ) { - if ( test_bit(_PGC_need_scrub, &pg[i].count_info) ) + if ( test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) ) { if ( !(memflags & MEMF_no_scrub) ) scrub_one_page(&pg[i]); dirty_cnt++; - - spin_lock(&heap_lock); - pg[i].count_info &= ~PGC_need_scrub; - spin_unlock(&heap_lock); } else if ( !(memflags & MEMF_no_scrub) ) check_one_page(&pg[i]); -- generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |