Skip to content

Commit 07252df

Browse files
Kefeng Wangakpm00
authored andcommitted
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.com Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 1168076 commit 07252df

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

drivers/virtio/virtio_mem.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,7 @@ static void virtio_mem_sbm_notify_online(struct virtio_mem *vm,
862862
unsigned long mb_id,
863863
unsigned long start_pfn)
864864
{
865-
const bool is_movable = page_zonenum(pfn_to_page(start_pfn)) ==
866-
ZONE_MOVABLE;
865+
const bool is_movable = is_zone_movable_page(pfn_to_page(start_pfn));
867866
int new_state;
868867

869868
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)
11581157
*/
11591158
static int virtio_mem_fake_offline(unsigned long pfn, unsigned long nr_pages)
11601159
{
1161-
const bool is_movable = page_zonenum(pfn_to_page(pfn)) ==
1162-
ZONE_MOVABLE;
1160+
const bool is_movable = is_zone_movable_page(pfn_to_page(pfn));
11631161
int rc, retry_count;
11641162

11651163
/*

mm/memory_hotplug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ static struct zone *auto_movable_zone_for_pfn(int nid,
932932
if (!page)
933933
continue;
934934
/* If anything is !MOVABLE online the rest !MOVABLE. */
935-
if (page_zonenum(page) != ZONE_MOVABLE)
935+
if (!is_zone_movable_page(page))
936936
goto kernel_zone;
937937
online_pages += PAGES_PER_SECTION;
938938
}

0 commit comments

Comments
 (0)