From 5a8f90494321dab76656bee2c7b4de8181456484 Mon Sep 17 00:00:00 2001 From: Ma Wupeng Date: Tue, 1 Mar 2022 17:26:27 +0800 Subject: [PATCH] mm: Ratelimited mirrored memory related warning messages hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S CVE: NA -------------------------------- If system has mirrored memory, memblock will try to allocate mirrored memory firstly and fallback to non-mirrored memory when fails, but if with limited mirrored memory or some numa node without mirrored memory, lots of warning message about memblock allocation will occur. This patch ratelimit the warning message to avoid a very long print during bootup. Signed-off-by: Ma Wupeng Reviewed-by: Xie XiuQi Reviewed-by: Kefeng Wang Signed-off-by: Yang Yingliang --- mm/memblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 13be610a381f..80c6975ace6f 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -291,7 +291,7 @@ phys_addr_t __init_memblock memblock_find_in_range(phys_addr_t start, NUMA_NO_NODE, flags); if (!ret && (flags & MEMBLOCK_MIRROR)) { - pr_warn("Could not allocate %pap bytes of mirrored memory\n", + pr_warn_ratelimited("Could not allocate %pap bytes of mirrored memory\n", &size); flags &= ~MEMBLOCK_MIRROR; goto again; @@ -1425,7 +1425,7 @@ static void * __init memblock_virt_alloc_internal( if (flags & MEMBLOCK_MIRROR) { flags &= ~MEMBLOCK_MIRROR; - pr_warn("Could not allocate %pap bytes of mirrored memory\n", + pr_warn_ratelimited("Could not allocate %pap bytes of mirrored memory\n", &size); goto again; } -- GitLab