xen/page_alloc: Don't hold the heap_lock when clearing PGC_need_scrub
authorJulien Grall <jgrall@amazon.com>
Thu, 21 Jan 2021 11:12:00 +0000 (11:12 +0000)
committerJulien Grall <jgrall@amazon.com>
Wed, 7 Apr 2021 18:30:55 +0000 (19:30 +0100)
commit025eacc13f6147ffa99da5ecee4ed96e7fe8e887
treef72c8aa00110fe0f778762275fba0651e87385d3
parent625faf9f002bd6ff4b6457a016b8ff338223b659
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@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/page_alloc.c