* [PATCH] mm/memory_hotplug: Rate limit page migration warnings
@ 2021-05-05 14:05 Georgi Djakov
0 siblings, 0 replies; only message in thread
From: Georgi Djakov @ 2021-05-05 14:05 UTC (permalink / raw)
To: akpm, linux-mm; +Cc: linux-kernel, georgi.djakov, Liam Mark
From: Liam Mark <lmark@codeaurora.org>
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.
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
mm/memory_hotplug.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 70620d0dd923..64acbdc6bece 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1521,6 +1521,8 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
struct page *page, *head;
int ret = 0;
LIST_HEAD(source);
+ static DEFINE_RATELIMIT_STATE(migrate_rs, DEFAULT_RATELIMIT_INTERVAL,
+ DEFAULT_RATELIMIT_BURST);
for (pfn = start_pfn; pfn < end_pfn; pfn++) {
if (!pfn_valid(pfn))
@@ -1567,8 +1569,10 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
page_is_file_lru(page));
} else {
- pr_warn("failed to isolate pfn %lx\n", pfn);
- dump_page(page, "isolation failed");
+ if (__ratelimit(&migrate_rs)) {
+ pr_warn("failed to isolate pfn %lx\n", pfn);
+ dump_page(page, "isolation failed");
+ }
}
put_page(page);
}
@@ -1597,9 +1601,11 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
(unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_HOTPLUG);
if (ret) {
list_for_each_entry(page, &source, lru) {
- pr_warn("migrating pfn %lx failed ret:%d ",
- page_to_pfn(page), ret);
- dump_page(page, "migration failure");
+ if (__ratelimit(&migrate_rs)) {
+ pr_warn("migrating pfn %lx failed ret:%d\n",
+ page_to_pfn(page), ret);
+ dump_page(page, "migration failure");
+ }
}
putback_movable_pages(&source);
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-05 14:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-05 14:05 [PATCH] mm/memory_hotplug: Rate limit page migration warnings Georgi Djakov
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).