Commit 287b8977 authored by David Hildenbrand's avatar David Hildenbrand Committed by Michael Ellerman

powerpc/pseries/cmm: Use adjust_managed_page_count() insted of totalram_pages_*

adjust_managed_page_count() performs a totalram_pages_add(), but also
adjusts the managed pages of the zone. Let's use that instead, similar
to virtio-balloon. Use it before freeing a page.
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191031142933.10779-6-david@redhat.com
parent 4a1745c5
...@@ -164,7 +164,7 @@ static long cmm_alloc_pages(long nr) ...@@ -164,7 +164,7 @@ static long cmm_alloc_pages(long nr)
list_add(&page->lru, &cmm_page_list); list_add(&page->lru, &cmm_page_list);
loaned_pages++; loaned_pages++;
totalram_pages_dec(); adjust_managed_page_count(page, -1);
spin_unlock(&cmm_lock); spin_unlock(&cmm_lock);
nr--; nr--;
} }
...@@ -191,10 +191,10 @@ static long cmm_free_pages(long nr) ...@@ -191,10 +191,10 @@ static long cmm_free_pages(long nr)
break; break;
plpar_page_set_active(page); plpar_page_set_active(page);
list_del(&page->lru); list_del(&page->lru);
adjust_managed_page_count(page, 1);
__free_page(page); __free_page(page);
loaned_pages--; loaned_pages--;
nr--; nr--;
totalram_pages_inc();
} }
spin_unlock(&cmm_lock); spin_unlock(&cmm_lock);
cmm_dbg("End request with %ld pages unfulfilled\n", nr); cmm_dbg("End request with %ld pages unfulfilled\n", nr);
...@@ -518,10 +518,10 @@ static int cmm_mem_going_offline(void *arg) ...@@ -518,10 +518,10 @@ static int cmm_mem_going_offline(void *arg)
continue; continue;
plpar_page_set_active(page); plpar_page_set_active(page);
list_del(&page->lru); list_del(&page->lru);
adjust_managed_page_count(page, 1);
__free_page(page); __free_page(page);
freed++; freed++;
loaned_pages--; loaned_pages--;
totalram_pages_inc();
} }
spin_unlock(&cmm_lock); spin_unlock(&cmm_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment