From: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
To: Reza Arbab <arbab@linux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Daniel Kiper <daniel.kiper@oracle.com>,
Dan Williams <dan.j.williams@intel.com>,
Vlastimil Babka <vbabka@suse.cz>,
Tang Chen <tangchen@cn.fujitsu.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
David Vrabel <david.vrabel@citrix.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
David Rientjes <rientjes@google.com>,
Andrew Banman <abanman@sgi.com>, Chen Yucong <slaoub@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] memory-hotplug: add move_pfn_range()
Date: Tue, 10 May 2016 09:47:23 -0700 (PDT) [thread overview]
Message-ID: <5732109b.376b8c0a.19009.570e@mx.google.com> (raw)
In-Reply-To: <1462816419-4479-2-git-send-email-arbab@linux.vnet.ibm.com>
On Mon, 9 May 2016 12:53:37 -0500
Reza Arbab <arbab@linux.vnet.ibm.com> wrote:
> Add move_pfn_range(), a wrapper to call move_pfn_range_left() or
> move_pfn_range_right().
>
> No functional change. This will be utilized by a later patch.
>
> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Looks good to me.
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Thanks,
Yasuaki Ishimatsu
> ---
> mm/memory_hotplug.c | 38 ++++++++++++++++++++++++++++----------
> 1 file changed, 28 insertions(+), 10 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index aa34431..6b4b005 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -434,6 +434,25 @@ out_fail:
> return -1;
> }
>
> +static struct zone * __meminit move_pfn_range(int zone_shift,
> + unsigned long start_pfn, unsigned long end_pfn)
> +{
> + struct zone *zone = page_zone(pfn_to_page(start_pfn));
> + int ret = 0;
> +
> + if (zone_shift < 0)
> + ret = move_pfn_range_left(zone + zone_shift, zone,
> + start_pfn, end_pfn);
> + else if (zone_shift)
> + ret = move_pfn_range_right(zone, zone + zone_shift,
> + start_pfn, end_pfn);
> +
> + if (ret)
> + return NULL;
> +
> + return zone + zone_shift;
> +}
> +
> static void __meminit grow_pgdat_span(struct pglist_data *pgdat, unsigned long start_pfn,
> unsigned long end_pfn)
> {
> @@ -1024,6 +1043,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
> int nid;
> int ret;
> struct memory_notify arg;
> + int zone_shift = 0;
>
> /*
> * This doesn't need a lock to do pfn_to_page().
> @@ -1038,18 +1058,16 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
> return -EINVAL;
>
> if (online_type == MMOP_ONLINE_KERNEL &&
> - zone_idx(zone) == ZONE_MOVABLE) {
> - if (move_pfn_range_left(zone - 1, zone, pfn, pfn + nr_pages))
> - return -EINVAL;
> - }
> + zone_idx(zone) == ZONE_MOVABLE)
> + zone_shift = -1;
> +
> if (online_type == MMOP_ONLINE_MOVABLE &&
> - zone_idx(zone) == ZONE_MOVABLE - 1) {
> - if (move_pfn_range_right(zone, zone + 1, pfn, pfn + nr_pages))
> - return -EINVAL;
> - }
> + zone_idx(zone) == ZONE_MOVABLE - 1)
> + zone_shift = 1;
>
> - /* Previous code may changed the zone of the pfn range */
> - zone = page_zone(pfn_to_page(pfn));
> + zone = move_pfn_range(zone_shift, pfn, pfn + nr_pages);
> + if (!zone)
> + return -EINVAL;
>
> arg.start_pfn = pfn;
> arg.nr_pages = nr_pages;
> --
> 1.8.3.1
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-05-10 16:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 17:53 [PATCH 0/3] memory-hotplug: improve rezoning capability Reza Arbab
2016-05-09 17:53 ` [PATCH 1/3] memory-hotplug: add move_pfn_range() Reza Arbab
2016-05-10 16:47 ` Yasuaki Ishimatsu [this message]
2016-05-09 17:53 ` [PATCH 2/3] memory-hotplug: more general validation of zone during online Reza Arbab
2016-05-10 18:08 ` Yasuaki Ishimatsu
2016-05-10 20:39 ` Reza Arbab
2016-05-11 15:17 ` Yasuaki Ishimatsu
2016-05-11 19:23 ` Reza Arbab
2016-05-13 17:24 ` Yasuaki Ishimatsu
2016-05-13 17:26 ` Yasuaki Ishimatsu
2016-05-09 17:53 ` [PATCH 3/3] memory-hotplug: use zone_can_shift() for sysfs valid_zones attribute Reza Arbab
2016-05-13 17:38 ` Yasuaki Ishimatsu
2016-05-09 20:11 ` [PATCH 0/3] memory-hotplug: improve rezoning capability Andrew Morton
2016-05-09 20:13 ` Andrew Morton
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=5732109b.376b8c0a.19009.570e@mx.google.com \
--to=yasu.isimatu@gmail.com \
--cc=abanman@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=arbab@linux.vnet.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=daniel.kiper@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=gregkh@linuxfoundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=slaoub@gmail.com \
--cc=tangchen@cn.fujitsu.com \
--cc=vbabka@suse.cz \
--cc=vkuznets@redhat.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;
as well as URLs for NNTP newsgroup(s).