]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: ratelimit min_free_kbytes adjustment messages
authorBreno Leitao <leitao@debian.org>
Tue, 17 Mar 2026 15:33:59 +0000 (08:33 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:27 +0000 (13:53 -0700)
The "raising min_free_kbytes" pr_info message in
set_recommended_min_free_kbytes() and the "min_free_kbytes is not updated
to" pr_warn in calculate_min_free_kbytes() can spam the kernel log when
called repeatedly.

Switch the pr_info in set_recommended_min_free_kbytes() and the pr_warn in
calculate_min_free_kbytes() to their _ratelimited variants to prevent the
log spam for this message.

Link: https://lkml.kernel.org/r/20260317-thp_logs-v7-4-31eb98fa5a8b@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: Zi Yan <ziy@nvidia.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Usama Arif <usamaarif642@gmail.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/khugepaged.c
mm/page_alloc.c

index e1eb3c7e59c37bc64b87bd4c4376e6445182aae0..f972a9a65e3aa3a805de7373080db12d32dbd5c2 100644 (file)
@@ -2701,8 +2701,8 @@ void set_recommended_min_free_kbytes(void)
 
        if (recommended_min > min_free_kbytes) {
                if (user_min_free_kbytes >= 0)
-                       pr_info("raising min_free_kbytes from %d to %lu to help transparent hugepage allocations\n",
-                               min_free_kbytes, recommended_min);
+                       pr_info_ratelimited("raising min_free_kbytes from %d to %lu to help transparent hugepage allocations\n",
+                                           min_free_kbytes, recommended_min);
 
                min_free_kbytes = recommended_min;
        }
index fdcc2fde565b7866d3f2853af22959cabea90ef0..937e9b8507091f8ce74a9568b08ebfa33373d337 100644 (file)
@@ -6514,8 +6514,8 @@ void calculate_min_free_kbytes(void)
        if (new_min_free_kbytes > user_min_free_kbytes)
                min_free_kbytes = clamp(new_min_free_kbytes, 128, 262144);
        else
-               pr_warn("min_free_kbytes is not updated to %d because user defined value %d is preferred\n",
-                               new_min_free_kbytes, user_min_free_kbytes);
+               pr_warn_ratelimited("min_free_kbytes is not updated to %d because user defined value %d is preferred\n",
+                                   new_min_free_kbytes, user_min_free_kbytes);
 
 }