Skip to content

Commit

Permalink
mm: use is_zone_movable_page() helper
Browse files Browse the repository at this point in the history
Use is_zone_movable_page() helper to simplify code.

Link: https://lkml.kernel.org/r/20220726131135.146912-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Kefeng Wang authored and akpm committed Jul 27, 2022
1 parent 266383e commit 3a0af02
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions drivers/virtio/virtio_mem.c
Original file line number Diff line number Diff line change
@@ -862,8 +862,7 @@ static void virtio_mem_sbm_notify_online(struct virtio_mem *vm,
unsigned long mb_id,
unsigned long start_pfn)
{
const bool is_movable = page_zonenum(pfn_to_page(start_pfn)) ==
ZONE_MOVABLE;
const bool is_movable = is_zone_movable_page(pfn_to_page(start_pfn));
int new_state;

switch (virtio_mem_sbm_get_mb_state(vm, mb_id)) {
@@ -1158,8 +1157,7 @@ static void virtio_mem_fake_online(unsigned long pfn, unsigned long nr_pages)
*/
static int virtio_mem_fake_offline(unsigned long pfn, unsigned long nr_pages)
{
const bool is_movable = page_zonenum(pfn_to_page(pfn)) ==
ZONE_MOVABLE;
const bool is_movable = is_zone_movable_page(pfn_to_page(pfn));
int rc, retry_count;

/*
2 changes: 1 addition & 1 deletion mm/memory_hotplug.c
Original file line number Diff line number Diff line change
@@ -932,7 +932,7 @@ static struct zone *auto_movable_zone_for_pfn(int nid,
if (!page)
continue;
/* If anything is !MOVABLE online the rest !MOVABLE. */
if (page_zonenum(page) != ZONE_MOVABLE)
if (!is_zone_movable_page(page))
goto kernel_zone;
online_pages += PAGES_PER_SECTION;
}

0 comments on commit 3a0af02

Please sign in to comment.