Commit 07252dfe authored by Kefeng Wang's avatar Kefeng Wang Committed by akpm

mm: use is_zone_movable_page() helper

Use is_zone_movable_page() helper to simplify code.

Link: https://lkml.kernel.org/r/20220726131135.146912-1-wangkefeng.wang@huawei.comSigned-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarPankaj Gupta <pankaj.gupta@amd.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 11680763
...@@ -862,8 +862,7 @@ static void virtio_mem_sbm_notify_online(struct virtio_mem *vm, ...@@ -862,8 +862,7 @@ static void virtio_mem_sbm_notify_online(struct virtio_mem *vm,
unsigned long mb_id, unsigned long mb_id,
unsigned long start_pfn) unsigned long start_pfn)
{ {
const bool is_movable = page_zonenum(pfn_to_page(start_pfn)) == const bool is_movable = is_zone_movable_page(pfn_to_page(start_pfn));
ZONE_MOVABLE;
int new_state; int new_state;
switch (virtio_mem_sbm_get_mb_state(vm, mb_id)) { 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) ...@@ -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) static int virtio_mem_fake_offline(unsigned long pfn, unsigned long nr_pages)
{ {
const bool is_movable = page_zonenum(pfn_to_page(pfn)) == const bool is_movable = is_zone_movable_page(pfn_to_page(pfn));
ZONE_MOVABLE;
int rc, retry_count; int rc, retry_count;
/* /*
......
...@@ -932,7 +932,7 @@ static struct zone *auto_movable_zone_for_pfn(int nid, ...@@ -932,7 +932,7 @@ static struct zone *auto_movable_zone_for_pfn(int nid,
if (!page) if (!page)
continue; continue;
/* If anything is !MOVABLE online the rest !MOVABLE. */ /* If anything is !MOVABLE online the rest !MOVABLE. */
if (page_zonenum(page) != ZONE_MOVABLE) if (!is_zone_movable_page(page))
goto kernel_zone; goto kernel_zone;
online_pages += PAGES_PER_SECTION; online_pages += PAGES_PER_SECTION;
} }
......
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