[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 04/10] xen/balloon: factor out function to update balloon stats
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- drivers/xen/balloon.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index d8055f0..04e12b4 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -107,17 +107,24 @@ static void scrub_page(struct page *page) #endif } +static inline void update_balloon_stats(struct page *page, int count) +{ + if (PageHighMem(page)) + xen_balloon.balloon_stats.balloon_high += count; + else + xen_balloon.balloon_stats.balloon_low += count; +} + /* balloon_append: add the given page to the balloon. */ static void __balloon_append(struct page *page) { /* Lowmem is re-populated first, so highmem pages go at list tail. */ - if (PageHighMem(page)) { + if (PageHighMem(page)) list_add_tail(&page->lru, &xen_balloon.ballooned_pages); - xen_balloon.balloon_stats.balloon_high++; - } else { + else list_add(&page->lru, &xen_balloon.ballooned_pages); - xen_balloon.balloon_stats.balloon_low++; - } + + update_balloon_stats(page, 1); } static void balloon_append(struct page *page) @@ -142,10 +149,7 @@ static struct page *balloon_retrieve(bool prefer_highmem) struct page, lru); list_del(&page->lru); - if (PageHighMem(page)) - xen_balloon.balloon_stats.balloon_high--; - else - xen_balloon.balloon_stats.balloon_low--; + update_balloon_stats(page, -1); adjust_managed_page_count(page, 1); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |