Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1449468 > unrolled thread
| Started by | Xishi Qiu <qiuxishi@huawei.com> |
|---|---|
| First post | 2016-07-25 15:20 +0200 |
| Last post | 2016-07-26 03:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline Xishi Qiu <qiuxishi@huawei.com> - 2016-07-25 15:20 +0200
Re: [PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline Andrew Morton <akpm@linux-foundation.org> - 2016-07-25 23:00 +0200
Re: [PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline Xishi Qiu <qiuxishi@huawei.com> - 2016-07-26 03:40 +0200
| From | Xishi Qiu <qiuxishi@huawei.com> |
|---|---|
| Date | 2016-07-25 15:20 +0200 |
| Subject | [PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline |
| Message-ID | <rYNXA-51i-15@gated-at.bofh.it> |
If we offline a node, alloc the new page from a nearest neighbor
node instead of the current node or other remote nodes, because
re-migrate is a waste of time and the distance of the remote nodes
is often very large.
Also use GFP_HIGHUSER_MOVABLE to alloc new page if the zone is
movable zone or highmem zone.
Changelog:
V3:
-alloc new page from a nearest neighbor node for both
movable zone and non-movable zone
V2:
-alloc new page from the next node for only movable zone
Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
---
mm/memory_hotplug.c | 38 +++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index e3cbdca..04dcf0e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1501,6 +1501,37 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
return 0;
}
+static struct page *new_node_page(struct page *page, unsigned long private,
+ int **result)
+{
+ gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE;
+ int nid = page_to_nid(page);
+ nodemask_t nmask = node_online_map;
+ struct page *new_page;
+
+ /*
+ * TODO: allocate a destination hugepage from a nearest neighbor node,
+ * accordance with memory policy of the user process if possible. For
+ * now as a simple work-around, we use the next node for destination.
+ */
+ if (PageHuge(page))
+ return alloc_huge_page_node(page_hstate(compound_head(page)),
+ next_node_in(nid, nmask));
+
+ node_clear(nid, nmask);
+ if (PageHighMem(page)
+ || (zone_idx(page_zone(page)) == ZONE_MOVABLE))
+ gfp_mask |= __GFP_HIGHMEM;
+
+ new_page = __alloc_pages_nodemask(gfp_mask, 0,
+ node_zonelist(nid, gfp_mask), &nmask);
+ if (!new_page)
+ new_page = __alloc_pages(gfp_mask, 0,
+ node_zonelist(nid, gfp_mask));
+
+ return new_page;
+}
+
#define NR_OFFLINE_AT_ONCE_PAGES (256)
static int
do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
@@ -1564,11 +1595,8 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
goto out;
}
- /*
- * alloc_migrate_target should be improooooved!!
- * migrate_pages returns # of failed pages.
- */
- ret = migrate_pages(&source, alloc_migrate_target, NULL, 0,
+ /* Allocate a new page from the nearest neighbor node */
+ ret = migrate_pages(&source, new_node_page, NULL, 0,
MIGRATE_SYNC, MR_MEMORY_HOTPLUG);
if (ret)
putback_movable_pages(&source);
--
1.8.3.1
[toc] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2016-07-25 23:00 +0200 |
| Subject | Re: [PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline |
| Message-ID | <rYV8L-Pn-35@gated-at.bofh.it> |
| In reply to | #1449468 |
On Mon, 25 Jul 2016 17:53:15 +0800 Xishi Qiu <qiuxishi@huawei.com> wrote: > Subject: [PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline argh. This is "v3" but there is no v1 and no v2. Please don't change the name of patches in this manner. Or if you do, please be clear which patch is being updated. I'll drop your mem-hotplug-use-different-mempolicy-in-alloc_migrate_target.patch.
[toc] | [prev] | [next] | [standalone]
| From | Xishi Qiu <qiuxishi@huawei.com> |
|---|---|
| Date | 2016-07-26 03:40 +0200 |
| Subject | Re: [PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline |
| Message-ID | <rYZvH-3YA-7@gated-at.bofh.it> |
| In reply to | #1449815 |
On 2016/7/26 4:51, Andrew Morton wrote: > On Mon, 25 Jul 2016 17:53:15 +0800 Xishi Qiu <qiuxishi@huawei.com> wrote: > >> Subject: [PATCH v3] mem-hotplug: alloc new page from a nearest neighbor node when mem-offline > > argh. > > This is "v3" but there is no v1 and no v2. Please don't change the > name of patches in this manner. Or if you do, please be clear which > patch is being updated. > > I'll drop your > mem-hotplug-use-different-mempolicy-in-alloc_migrate_target.patch. > Hi Andrew, Sorry for the confusion of title. The following patches are all the old versions and please drop them all. [PATCH] mem-hotplug: use GFP_HIGHUSER_MOVABLE and alloc from next node in alloc_migrate_target() [PATCH 1/2] mem-hotplug: use GFP_HIGHUSER_MOVABLE in, alloc_migrate_target() [PATCH 2/2] mem-hotplug: use different mempolicy in alloc_migrate_target() [PATCH v2] mem-hotplug: alloc new page from the next node if zone is MOVABLE_ZONE Thanks, Xishi Qiu > . >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web