mm/memory_hotplug: rate limit page migration warnings
commit 786dee864804f8e851cf0f258df2ccbb4ee03d80 upstream. When offlining memory the system can attempt to migrate a lot of pages, if there are problems with migration this can flood the logs. Printing all the data hogs the CPU and cause some RT threads to run for a long time, which may have some bad consequences. Rate limit the page migration warnings in order to avoid this. Link: https://lkml.kernel.org/r/20210505140542.24935-1-georgi.djakov@linaro.org Signed-off-by: Liam Mark <lmark@codeaurora.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Cc: David Hildenbrand <david@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: <pjy@amazon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
bf97ea76ea
commit
f10690787d
@@ -1279,6 +1279,8 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
|
|||||||
struct page *page, *head;
|
struct page *page, *head;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
LIST_HEAD(source);
|
LIST_HEAD(source);
|
||||||
|
static DEFINE_RATELIMIT_STATE(migrate_rs, DEFAULT_RATELIMIT_INTERVAL,
|
||||||
|
DEFAULT_RATELIMIT_BURST);
|
||||||
|
|
||||||
for (pfn = start_pfn; pfn < end_pfn; pfn++) {
|
for (pfn = start_pfn; pfn < end_pfn; pfn++) {
|
||||||
if (!pfn_valid(pfn))
|
if (!pfn_valid(pfn))
|
||||||
@@ -1325,8 +1327,10 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
|
|||||||
page_is_file_lru(page));
|
page_is_file_lru(page));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
pr_warn("failed to isolate pfn %lx\n", pfn);
|
if (__ratelimit(&migrate_rs)) {
|
||||||
dump_page(page, "isolation failed");
|
pr_warn("failed to isolate pfn %lx\n", pfn);
|
||||||
|
dump_page(page, "isolation failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
put_page(page);
|
put_page(page);
|
||||||
}
|
}
|
||||||
@@ -1355,9 +1359,11 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
|
|||||||
(unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_HOTPLUG);
|
(unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_HOTPLUG);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
list_for_each_entry(page, &source, lru) {
|
list_for_each_entry(page, &source, lru) {
|
||||||
pr_warn("migrating pfn %lx failed ret:%d ",
|
if (__ratelimit(&migrate_rs)) {
|
||||||
page_to_pfn(page), ret);
|
pr_warn("migrating pfn %lx failed ret:%d\n",
|
||||||
dump_page(page, "migration failure");
|
page_to_pfn(page), ret);
|
||||||
|
dump_page(page, "migration failure");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
putback_movable_pages(&source);
|
putback_movable_pages(&source);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user