linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  "Michael S. Tsirkin" <mst@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: use is_zone_movable_page() helper
Date: Wed, 27 Jul 2022 12:59:50 +0800	[thread overview]
Message-ID: <CACGkMEvZDfxt97_GfE6oYwj6mQX95zUAz-B2k2FaedBeDUe9bw@mail.gmail.com> (raw)
In-Reply-To: <20220726131135.146912-1-wangkefeng.wang@huawei.com>

On Tue, Jul 26, 2022 at 9:05 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Use is_zone_movable_page() helper to simplify code.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/virtio/virtio_mem.c | 6 ++----
>  mm/memory_hotplug.c         | 2 +-
>  2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index e07486f01999..0c2892ec6817 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -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;
>
>         /*
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 1213d0c67a53..0f5914964a32 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -936,7 +936,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;
>                 }
> --
> 2.35.3
>



  parent reply	other threads:[~2022-07-27  5:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 13:11 Kefeng Wang
2022-07-26 13:05 ` David Hildenbrand
2022-07-27  4:59 ` Jason Wang [this message]
2022-07-27  5:19 ` Pankaj Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACGkMEvZDfxt97_GfE6oYwj6mQX95zUAz-B2k2FaedBeDUe9bw@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mst@redhat.com \
    --cc=osalvador@suse.de \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox