diff options
author | Chen Yucong <slaoub@gmail.com> | 2016-03-17 17:19:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 18:09:34 -0400 |
commit | e33e33b4d1c699d06fb8ccd6da80b309b84ec975 (patch) | |
tree | 998674163dbc357c82c3be860ecbd6a379cc860e /mm/memory_hotplug.c | |
parent | 0f352e5392c86d054998dd6526f2fdc33ec4bed5 (diff) |
mm, memory hotplug: print debug message in the proper way for online_pages
online_pages() simply returns an error value if
memory_notify(MEM_GOING_ONLINE, &arg) return a value that is not what we
want for successfully onlining target pages. This patch arms to print
more failure information like offline_pages() in online_pages.
This patch also converts printk(KERN_<LEVEL>) to pr_<level>(), and moves
__offline_pages() to not print failure information with KERN_INFO
according to David Rientjes's suggestion[1].
[1] https://lkml.org/lkml/2016/2/24/1094
Signed-off-by: Chen Yucong <slaoub@gmail.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e62aa078f5c9..f5758b678608 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1059,10 +1059,9 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ | |||
1059 | 1059 | ||
1060 | ret = memory_notify(MEM_GOING_ONLINE, &arg); | 1060 | ret = memory_notify(MEM_GOING_ONLINE, &arg); |
1061 | ret = notifier_to_errno(ret); | 1061 | ret = notifier_to_errno(ret); |
1062 | if (ret) { | 1062 | if (ret) |
1063 | memory_notify(MEM_CANCEL_ONLINE, &arg); | 1063 | goto failed_addition; |
1064 | return ret; | 1064 | |
1065 | } | ||
1066 | /* | 1065 | /* |
1067 | * If this zone is not populated, then it is not in zonelist. | 1066 | * If this zone is not populated, then it is not in zonelist. |
1068 | * This means the page allocator ignores this zone. | 1067 | * This means the page allocator ignores this zone. |
@@ -1080,12 +1079,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ | |||
1080 | if (need_zonelists_rebuild) | 1079 | if (need_zonelists_rebuild) |
1081 | zone_pcp_reset(zone); | 1080 | zone_pcp_reset(zone); |
1082 | mutex_unlock(&zonelists_mutex); | 1081 | mutex_unlock(&zonelists_mutex); |
1083 | printk(KERN_DEBUG "online_pages [mem %#010llx-%#010llx] failed\n", | 1082 | goto failed_addition; |
1084 | (unsigned long long) pfn << PAGE_SHIFT, | ||
1085 | (((unsigned long long) pfn + nr_pages) | ||
1086 | << PAGE_SHIFT) - 1); | ||
1087 | memory_notify(MEM_CANCEL_ONLINE, &arg); | ||
1088 | return ret; | ||
1089 | } | 1083 | } |
1090 | 1084 | ||
1091 | zone->present_pages += onlined_pages; | 1085 | zone->present_pages += onlined_pages; |
@@ -1118,6 +1112,13 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ | |||
1118 | if (onlined_pages) | 1112 | if (onlined_pages) |
1119 | memory_notify(MEM_ONLINE, &arg); | 1113 | memory_notify(MEM_ONLINE, &arg); |
1120 | return 0; | 1114 | return 0; |
1115 | |||
1116 | failed_addition: | ||
1117 | pr_debug("online_pages [mem %#010llx-%#010llx] failed\n", | ||
1118 | (unsigned long long) pfn << PAGE_SHIFT, | ||
1119 | (((unsigned long long) pfn + nr_pages) << PAGE_SHIFT) - 1); | ||
1120 | memory_notify(MEM_CANCEL_ONLINE, &arg); | ||
1121 | return ret; | ||
1121 | } | 1122 | } |
1122 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ | 1123 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
1123 | 1124 | ||
@@ -1529,8 +1530,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) | |||
1529 | 1530 | ||
1530 | } else { | 1531 | } else { |
1531 | #ifdef CONFIG_DEBUG_VM | 1532 | #ifdef CONFIG_DEBUG_VM |
1532 | printk(KERN_ALERT "removing pfn %lx from LRU failed\n", | 1533 | pr_alert("removing pfn %lx from LRU failed\n", pfn); |
1533 | pfn); | ||
1534 | dump_page(page, "failed to remove from LRU"); | 1534 | dump_page(page, "failed to remove from LRU"); |
1535 | #endif | 1535 | #endif |
1536 | put_page(page); | 1536 | put_page(page); |
@@ -1858,7 +1858,7 @@ repeat: | |||
1858 | ret = -EBUSY; | 1858 | ret = -EBUSY; |
1859 | goto failed_removal; | 1859 | goto failed_removal; |
1860 | } | 1860 | } |
1861 | printk(KERN_INFO "Offlined Pages %ld\n", offlined_pages); | 1861 | pr_info("Offlined Pages %ld\n", offlined_pages); |
1862 | /* Ok, all of our target is isolated. | 1862 | /* Ok, all of our target is isolated. |
1863 | We cannot do rollback at this point. */ | 1863 | We cannot do rollback at this point. */ |
1864 | offline_isolated_pages(start_pfn, end_pfn); | 1864 | offline_isolated_pages(start_pfn, end_pfn); |
@@ -1895,9 +1895,9 @@ repeat: | |||
1895 | return 0; | 1895 | return 0; |
1896 | 1896 | ||
1897 | failed_removal: | 1897 | failed_removal: |
1898 | printk(KERN_INFO "memory offlining [mem %#010llx-%#010llx] failed\n", | 1898 | pr_debug("memory offlining [mem %#010llx-%#010llx] failed\n", |
1899 | (unsigned long long) start_pfn << PAGE_SHIFT, | 1899 | (unsigned long long) start_pfn << PAGE_SHIFT, |
1900 | ((unsigned long long) end_pfn << PAGE_SHIFT) - 1); | 1900 | ((unsigned long long) end_pfn << PAGE_SHIFT) - 1); |
1901 | memory_notify(MEM_CANCEL_OFFLINE, &arg); | 1901 | memory_notify(MEM_CANCEL_OFFLINE, &arg); |
1902 | /* pushback to free area */ | 1902 | /* pushback to free area */ |
1903 | undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); | 1903 | undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); |