Skip to content

Commit

Permalink
powerpc/pseries/cmm: Use adjust_managed_page_count() insted of totalr…
Browse files Browse the repository at this point in the history
…am_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: David Hildenbrand <david@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191031142933.10779-6-david@redhat.com
  • Loading branch information
David Hildenbrand authored and Michael Ellerman committed Nov 13, 2019
1 parent 4a1745c commit 287b897
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/powerpc/platforms/pseries/cmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static long cmm_alloc_pages(long nr)

list_add(&page->lru, &cmm_page_list);
loaned_pages++;
totalram_pages_dec();
adjust_managed_page_count(page, -1);
spin_unlock(&cmm_lock);
nr--;
}
Expand All @@ -191,10 +191,10 @@ static long cmm_free_pages(long nr)
break;
plpar_page_set_active(page);
list_del(&page->lru);
adjust_managed_page_count(page, 1);
__free_page(page);
loaned_pages--;
nr--;
totalram_pages_inc();
}
spin_unlock(&cmm_lock);
cmm_dbg("End request with %ld pages unfulfilled\n", nr);
Expand Down Expand Up @@ -518,10 +518,10 @@ static int cmm_mem_going_offline(void *arg)
continue;
plpar_page_set_active(page);
list_del(&page->lru);
adjust_managed_page_count(page, 1);
__free_page(page);
freed++;
loaned_pages--;
totalram_pages_inc();
}

spin_unlock(&cmm_lock);
Expand Down

0 comments on commit 287b897

Please sign in to comment.