Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1516669 > unrolled thread
| Started by | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| First post | 2016-11-08 00:40 +0100 |
| Last post | 2016-11-08 02:50 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 12/12] mm: memory_hotplug: memory hotremove supports thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-08 00:40 +0100
Re: [PATCH v2 12/12] mm: memory_hotplug: memory hotremove supports thp migration kbuild test robot <lkp@intel.com> - 2016-11-08 01:40 +0100
[PATCH] mm: fix unused variable warning Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-08 02:50 +0100
Re: [PATCH v2 12/12] mm: memory_hotplug: memory hotremove supports thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-08 02:50 +0100
| From | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| Date | 2016-11-08 00:40 +0100 |
| Subject | [PATCH v2 12/12] mm: memory_hotplug: memory hotremove supports thp migration |
| Message-ID | <sB1Ga-1xZ-31@gated-at.bofh.it> |
This patch enables thp migration for memory hotremove.
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
ChangeLog v1->v2:
- base code switched from alloc_migrate_target to new_node_page()
---
mm/memory_hotplug.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory_hotplug.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory_hotplug.c
index b18dab40..a9c3fe1 100644
--- v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory_hotplug.c
+++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory_hotplug.c
@@ -1543,6 +1543,7 @@ static struct page *new_node_page(struct page *page, unsigned long private,
int nid = page_to_nid(page);
nodemask_t nmask = node_states[N_MEMORY];
struct page *new_page = NULL;
+ unsigned int order = 0;
/*
* TODO: allocate a destination hugepage from a nearest neighbor node,
@@ -1553,6 +1554,11 @@ static struct page *new_node_page(struct page *page, unsigned long private,
return alloc_huge_page_node(page_hstate(compound_head(page)),
next_node_in(nid, nmask));
+ if (thp_migration_supported() && PageTransHuge(page)) {
+ order = HPAGE_PMD_ORDER;
+ gfp_mask |= GFP_TRANSHUGE;
+ }
+
node_clear(nid, nmask);
if (PageHighMem(page)
@@ -1560,12 +1566,15 @@ static struct page *new_node_page(struct page *page, unsigned long private,
gfp_mask |= __GFP_HIGHMEM;
if (!nodes_empty(nmask))
- new_page = __alloc_pages_nodemask(gfp_mask, 0,
+ new_page = __alloc_pages_nodemask(gfp_mask, order,
node_zonelist(nid, gfp_mask), &nmask);
if (!new_page)
- new_page = __alloc_pages(gfp_mask, 0,
+ new_page = __alloc_pages(gfp_mask, order,
node_zonelist(nid, gfp_mask));
+ if (new_page && order == HPAGE_PMD_ORDER)
+ prep_transhuge_page(new_page);
+
return new_page;
}
@@ -1595,7 +1604,9 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
if (isolate_huge_page(page, &source))
move_pages -= 1 << compound_order(head);
continue;
- }
+ } else if (thp_migration_supported() && PageTransHuge(page))
+ pfn = page_to_pfn(compound_head(page))
+ + HPAGE_PMD_NR - 1;
if (!get_page_unless_zero(page))
continue;
--
2.7.0
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-11-08 01:40 +0100 |
| Subject | Re: [PATCH v2 12/12] mm: memory_hotplug: memory hotremove supports thp migration |
| Message-ID | <sB2Cd-29A-7@gated-at.bofh.it> |
| In reply to | #1516669 |
[Multipart message — attachments visible in raw view] — view raw
Hi Naoya,
[auto build test WARNING on mmotm/master]
[also build test WARNING on next-20161028]
[cannot apply to v4.9-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Naoya-Horiguchi/mm-x86-move-_PAGE_SWP_SOFT_DIRTY-from-bit-7-to-bit-6/20161108-080615
base: git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-x000-201645 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
Cyclomatic Complexity 3 mm/memory_hotplug.c:setup_memhp_default_state
Cyclomatic Complexity 6 mm/memory_hotplug.c:find_smallest_section_pfn
Cyclomatic Complexity 6 mm/memory_hotplug.c:find_biggest_section_pfn
Cyclomatic Complexity 9 mm/memory_hotplug.c:shrink_pgdat_span
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 2 include/linux/page-flags.h:compound_head
Cyclomatic Complexity 1 include/linux/page_ref.h:page_count
Cyclomatic Complexity 2 include/linux/thread_info.h:test_ti_thread_flag
Cyclomatic Complexity 1 include/linux/sched.h:test_tsk_thread_flag
Cyclomatic Complexity 1 include/linux/sched.h:signal_pending
Cyclomatic Complexity 0 include/linux/memory_hotplug.h:generic_alloc_nodedata
Cyclomatic Complexity 3 mm/memory_hotplug.c:next_active_pageblock
Cyclomatic Complexity 1 mm/memory_hotplug.c:__online_page_increment_counters
Cyclomatic Complexity 1 include/linux/mm.h:__free_reserved_page
Cyclomatic Complexity 1 include/linux/mm.h:free_reserved_page
Cyclomatic Complexity 1 mm/memory_hotplug.c:__online_page_free
Cyclomatic Complexity 1 mm/memory_hotplug.c:generic_online_page
Cyclomatic Complexity 1 include/linux/mm.h:put_page_testzero
Cyclomatic Complexity 4 mm/memory_hotplug.c:check_hotplug_memory_range
Cyclomatic Complexity 1 mm/memory_hotplug.c:cmdline_parse_movable_node
Cyclomatic Complexity 2 mm/memory_hotplug.c:ensure_zone_is_initialized
Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqcount_begin_nested
Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqcount_begin
Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqlock
Cyclomatic Complexity 1 include/linux/memory_hotplug.h:zone_span_writelock
Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqcount_end
Cyclomatic Complexity 1 include/linux/seqlock.h:write_sequnlock
Cyclomatic Complexity 1 include/linux/memory_hotplug.h:zone_span_writeunlock
Cyclomatic Complexity 3 mm/memory_hotplug.c:grow_zone_span
Cyclomatic Complexity 4 mm/memory_hotplug.c:__add_zone
Cyclomatic Complexity 4 mm/memory_hotplug.c:__add_section
Cyclomatic Complexity 7 mm/memory_hotplug.c:__add_pages
Cyclomatic Complexity 9 mm/memory_hotplug.c:shrink_zone_span
Cyclomatic Complexity 1 mm/memory_hotplug.c:__remove_zone
Cyclomatic Complexity 2 mm/memory_hotplug.c:resize_zone
Cyclomatic Complexity 6 mm/memory_hotplug.c:move_pfn_range_left
Cyclomatic Complexity 6 mm/memory_hotplug.c:move_pfn_range_right
Cyclomatic Complexity 4 mm/memory_hotplug.c:move_pfn_range
Cyclomatic Complexity 3 mm/memory_hotplug.c:__remove_section
Cyclomatic Complexity 6 mm/memory_hotplug.c:__remove_pages
Cyclomatic Complexity 2 mm/memory_hotplug.c:check_pages_isolated
Cyclomatic Complexity 1 mm/memory_hotplug.c:offline_isolated_pages
Cyclomatic Complexity 3 mm/memory_hotplug.c:hotadd_new_pgdat
Cyclomatic Complexity 1 mm/memory_hotplug.c:online_memory_block
Cyclomatic Complexity 1 mm/memory_hotplug.c:rollback_node_hotadd
Cyclomatic Complexity 4 mm/memory_hotplug.c:register_memory_resource
Cyclomatic Complexity 2 mm/memory_hotplug.c:release_memory_resource
Cyclomatic Complexity 6 mm/memory_hotplug.c:scan_movable_pages
Cyclomatic Complexity 1 include/linux/gfp.h:__alloc_pages
Cyclomatic Complexity 1 include/linux/hugetlb.h:page_hstate
Cyclomatic Complexity 3 include/linux/bitmap.h:bitmap_empty
Cyclomatic Complexity 1 include/linux/nodemask.h:__nodes_empty
Cyclomatic Complexity 12 mm/memory_hotplug.c:new_node_page
Cyclomatic Complexity 3 include/linux/mm.h:put_page
Cyclomatic Complexity 15 mm/memory_hotplug.c:do_migrate_range
Cyclomatic Complexity 2 mm/memory_hotplug.c:check_pages_isolated_cb
Cyclomatic Complexity 1 mm/memory_hotplug.c:offline_isolated_pages_cb
Cyclomatic Complexity 2 mm/memory_hotplug.c:check_memblock_offlined_cb
Cyclomatic Complexity 2 mm/memory_hotplug.c:get_online_mems
Cyclomatic Complexity 6 mm/memory_hotplug.c:put_online_mems
Cyclomatic Complexity 2 mm/memory_hotplug.c:set_online_page_callback
Cyclomatic Complexity 2 mm/memory_hotplug.c:restore_online_page_callback
Cyclomatic Complexity 2 mm/memory_hotplug.c:mem_hotplug_begin
Cyclomatic Complexity 1 mm/memory_hotplug.c:mem_hotplug_done
Cyclomatic Complexity 1 mm/memory_hotplug.c:get_page_bootmem
Cyclomatic Complexity 2 mm/memory_hotplug.c:put_page_bootmem
Cyclomatic Complexity 9 mm/memory_hotplug.c:zone_can_shift
Cyclomatic Complexity 16 mm/memory_hotplug.c:online_pages
Cyclomatic Complexity 4 mm/memory_hotplug.c:try_online_node
Cyclomatic Complexity 2 mm/memory_hotplug.c:zone_for_memory
Cyclomatic Complexity 3 mm/memory_hotplug.c:is_mem_section_removable
Cyclomatic Complexity 7 mm/memory_hotplug.c:test_pages_in_a_zone
Cyclomatic Complexity 22 mm/memory_hotplug.c:__offline_pages
Cyclomatic Complexity 1 mm/memory_hotplug.c:offline_pages
Cyclomatic Complexity 9 mm/memory_hotplug.c:walk_memory_range
Cyclomatic Complexity 8 mm/memory_hotplug.c:add_memory_resource
Cyclomatic Complexity 3 mm/memory_hotplug.c:add_memory
Cyclomatic Complexity 1 mm/memory_hotplug.c:remove_memory
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from mm/memory_hotplug.c:7:
mm/memory_hotplug.c: In function 'new_node_page':
include/linux/compiler.h:518:38: error: call to '__compiletime_assert_1575' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:501:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:518:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/bug.h:88:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:181:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
>> include/linux/huge_mm.h:56:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
>> mm/memory_hotplug.c:1575:27: note: in expansion of macro 'HPAGE_PMD_ORDER'
if (new_page && order == HPAGE_PMD_ORDER)
^~~~~~~~~~~~~~~
vim +/HPAGE_PMD_ORDER +1575 mm/memory_hotplug.c
1559 gfp_mask |= GFP_TRANSHUGE;
1560 }
1561
1562 node_clear(nid, nmask);
1563
1564 if (PageHighMem(page)
1565 || (zone_idx(page_zone(page)) == ZONE_MOVABLE))
1566 gfp_mask |= __GFP_HIGHMEM;
1567
1568 if (!nodes_empty(nmask))
1569 new_page = __alloc_pages_nodemask(gfp_mask, order,
1570 node_zonelist(nid, gfp_mask), &nmask);
1571 if (!new_page)
1572 new_page = __alloc_pages(gfp_mask, order,
1573 node_zonelist(nid, gfp_mask));
1574
> 1575 if (new_page && order == HPAGE_PMD_ORDER)
1576 prep_transhuge_page(new_page);
1577
1578 return new_page;
1579 }
1580
1581 #define NR_OFFLINE_AT_ONCE_PAGES (256)
1582 static int
1583 do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| Date | 2016-11-08 02:50 +0100 |
| Subject | [PATCH] mm: fix unused variable warning |
| Message-ID | <sB3HX-2KB-7@gated-at.bofh.it> |
| In reply to | #1516669 |
Fix the following warning:
mm/memory_hotplug.c: In function 'try_offline_node':
mm/memory_hotplug.c:2131:6: warning: unused variable 'i' [-Wunused-variable]
int i;
^
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
mm/memory_hotplug.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 534348ddd285..d612a75ceec4 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -2128,7 +2128,6 @@ void try_offline_node(int nid)
unsigned long start_pfn = pgdat->node_start_pfn;
unsigned long end_pfn = start_pfn + pgdat->node_spanned_pages;
unsigned long pfn;
- int i;
for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
unsigned long section_nr = pfn_to_section_nr(pfn);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| Date | 2016-11-08 02:50 +0100 |
| Subject | Re: [PATCH v2 12/12] mm: memory_hotplug: memory hotremove supports thp migration |
| Message-ID | <sB3HX-2KB-5@gated-at.bofh.it> |
| In reply to | #1516669 |
On Tue, Nov 08, 2016 at 08:30:10AM +0800, kbuild test robot wrote:
> Hi Naoya,
>
> [auto build test WARNING on mmotm/master]
> [also build test WARNING on next-20161028]
> [cannot apply to v4.9-rc4]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Naoya-Horiguchi/mm-x86-move-_PAGE_SWP_SOFT_DIRTY-from-bit-7-to-bit-6/20161108-080615
> base: git://git.cmpxchg.org/linux-mmotm.git master
> config: x86_64-randconfig-x003-201645 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All warnings (new ones prefixed by >>):
>
> mm/memory_hotplug.c: In function 'try_offline_node':
> mm/memory_hotplug.c:2131:6: warning: unused variable 'i' [-Wunused-variable]
> int i;
> ^
> In file included from include/uapi/linux/stddef.h:1:0,
> from include/linux/stddef.h:4,
> from mm/memory_hotplug.c:7:
This seems unrelated to my patchset, but the fix is easy.
I'll post a separate patch later.
> mm/memory_hotplug.c: In function 'new_node_page':
> include/linux/compiler.h:518:38: error: call to '__compiletime_assert_1575' declared with attribute error: BUILD_BUG failed
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^
> include/linux/compiler.h:160:16: note: in definition of macro '__trace_if'
> ______r = !!(cond); \
> ^~~~
> >> mm/memory_hotplug.c:1575:2: note: in expansion of macro 'if'
> if (new_page && order == HPAGE_PMD_ORDER)
> ^~
> include/linux/compiler.h:506:2: note: in expansion of macro '__compiletime_assert'
> __compiletime_assert(condition, msg, prefix, suffix)
> ^~~~~~~~~~~~~~~~~~~~
> include/linux/compiler.h:518:2: note: in expansion of macro '_compiletime_assert'
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^~~~~~~~~~~~~~~~~~~
> include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
> #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> ^~~~~~~~~~~~~~~~~~
> include/linux/bug.h:88:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
> ^~~~~~~~~~~~~~~~
> include/linux/huge_mm.h:181:28: note: in expansion of macro 'BUILD_BUG'
> #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
> ^~~~~~~~~
> include/linux/huge_mm.h:56:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
> #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
> ^~~~~~~~~~~~~~~
> mm/memory_hotplug.c:1575:27: note: in expansion of macro 'HPAGE_PMD_ORDER'
> if (new_page && order == HPAGE_PMD_ORDER)
> ^~~~~~~~~~~~~~~
HPAGE_PMD_ORDER is not available in non-thp code now, so let's add
a simple wrapper to access it in generic code.
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 3c252cdef587..b75a9a1bbf3e 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -148,6 +148,12 @@ static inline int hpage_nr_pages(struct page *page)
return HPAGE_PMD_NR;
return 1;
}
+static inline int hpage_order(struct page *page)
+{
+ if (unlikely(PageTransHuge(page)))
+ return HPAGE_PMD_ORDER;
+ return 0;
+}
extern int do_huge_pmd_numa_page(struct fault_env *fe, pmd_t orig_pmd);
@@ -183,6 +189,7 @@ static inline bool thp_migration_supported(void)
#define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; })
#define hpage_nr_pages(x) 1
+#define hpage_order(x) 0
#define transparent_hugepage_enabled(__vma) 0
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index a9c3fe1b55ea..d612a75ceec4 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1555,7 +1555,7 @@ static struct page *new_node_page(struct page *page, unsigned long private,
next_node_in(nid, nmask));
if (thp_migration_supported() && PageTransHuge(page)) {
- order = HPAGE_PMD_ORDER;
+ order = hpage_order(page);
gfp_mask |= GFP_TRANSHUGE;
}
@@ -1572,7 +1572,7 @@ static struct page *new_node_page(struct page *page, unsigned long private,
new_page = __alloc_pages(gfp_mask, order,
node_zonelist(nid, gfp_mask));
- if (new_page && order == HPAGE_PMD_ORDER)
+ if (new_page && order == hpage_order(page))
prep_transhuge_page(new_page);
return new_page;
@@ -1606,7 +1606,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
continue;
} else if (thp_migration_supported() && PageTransHuge(page))
pfn = page_to_pfn(compound_head(page))
- + HPAGE_PMD_NR - 1;
+ + hpage_nr_pages(page) - 1;
if (!get_page_unless_zero(page))
continue;
These changes are applied in the next version.
Thanks,
Naoya Horiguchi
>
> vim +/if +1575 mm/memory_hotplug.c
>
> 1559 gfp_mask |= GFP_TRANSHUGE;
> 1560 }
> 1561
> 1562 node_clear(nid, nmask);
> 1563
> 1564 if (PageHighMem(page)
> 1565 || (zone_idx(page_zone(page)) == ZONE_MOVABLE))
> 1566 gfp_mask |= __GFP_HIGHMEM;
> 1567
> 1568 if (!nodes_empty(nmask))
> 1569 new_page = __alloc_pages_nodemask(gfp_mask, order,
> 1570 node_zonelist(nid, gfp_mask), &nmask);
> 1571 if (!new_page)
> 1572 new_page = __alloc_pages(gfp_mask, order,
> 1573 node_zonelist(nid, gfp_mask));
> 1574
> > 1575 if (new_page && order == HPAGE_PMD_ORDER)
> 1576 prep_transhuge_page(new_page);
> 1577
> 1578 return new_page;
> 1579 }
> 1580
> 1581 #define NR_OFFLINE_AT_ONCE_PAGES (256)
> 1582 static int
> 1583 do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web