mm: make show_free_areas() static
authorKefeng Wang <wangkefeng.wang@huawei.com>
Fri, 30 Jun 2023 06:22:53 +0000 (14:22 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 18 Aug 2023 17:12:02 +0000 (10:12 -0700)
All callers of show_free_areas() pass 0 and NULL, so we can directly use
show_mem() instead of show_free_areas(0, NULL), which could make
show_free_areas() a static function.

Link: https://lkml.kernel.org/r/20230630062253.189440-2-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/sparc/kernel/setup_32.c
include/linux/mm.h
mm/internal.h
mm/nommu.c
mm/show_mem.c

index 1adf5c1c16b856d20a1ed4a1f46b154e5a03b775..34ef7febf0d562052643730a5d19241f61143aa3 100644 (file)
@@ -83,7 +83,7 @@ static void prom_sync_me(void)
                             "nop\n\t" : : "r" (&trapbase));
 
        prom_printf("PROM SYNC COMMAND...\n");
-       show_free_areas(0, NULL);
+       show_mem();
        if (!is_idle_task(current)) {
                local_irq_enable();
                ksys_sync();
index 8c3e3eec9008be455946a0b1472fca0f73db8f8c..d1ad22980ebe7ab0fd06986c976ac6bb628c414c 100644 (file)
@@ -2236,18 +2236,6 @@ extern void pagefault_out_of_memory(void);
 #define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1))
 #define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1))
 
-/*
- * Flags passed to show_mem() and show_free_areas() to suppress output in
- * various contexts.
- */
-#define SHOW_MEM_FILTER_NODES          (0x0001u)       /* disallowed nodes */
-
-extern void __show_free_areas(unsigned int flags, nodemask_t *nodemask, int max_zone_idx);
-static void __maybe_unused show_free_areas(unsigned int flags, nodemask_t *nodemask)
-{
-       __show_free_areas(flags, nodemask, MAX_NR_ZONES - 1);
-}
-
 /*
  * Parameter block passed down to zap_pte_range in exceptional cases.
  */
index a7d9e980429a5511afdea566c26b8faa35ac2e12..721ed07d7fd6f1cfa9f8b4914369272e51a52298 100644 (file)
@@ -61,6 +61,12 @@ void page_writeback_init(void);
 #define COMPOUND_MAPPED                0x800000
 #define FOLIO_PAGES_MAPPED     (COMPOUND_MAPPED - 1)
 
+/*
+ * Flags passed to __show_mem() and show_free_areas() to suppress output in
+ * various contexts.
+ */
+#define SHOW_MEM_FILTER_NODES          (0x0001u)       /* disallowed nodes */
+
 /*
  * How many individual pages have an elevated _mapcount.  Excludes
  * the folio's entire_mapcount.
index c072a660ec2cfb522903828038a9fce9be19c4c1..9826f6101a05c08714ab19ecbb1911a3ab82dfa3 100644 (file)
@@ -1003,7 +1003,7 @@ error_free:
 enomem:
        pr_err("Allocation of length %lu from process %d (%s) failed\n",
               len, current->pid, current->comm);
-       show_free_areas(0, NULL);
+       show_mem();
        return -ENOMEM;
 }
 
@@ -1236,20 +1236,20 @@ error_getting_vma:
        kmem_cache_free(vm_region_jar, region);
        pr_warn("Allocation of vma for %lu byte allocation from process %d failed\n",
                        len, current->pid);
-       show_free_areas(0, NULL);
+       show_mem();
        return -ENOMEM;
 
 error_getting_region:
        pr_warn("Allocation of vm region for %lu byte allocation from process %d failed\n",
                        len, current->pid);
-       show_free_areas(0, NULL);
+       show_mem();
        return -ENOMEM;
 
 error_vma_iter_prealloc:
        kmem_cache_free(vm_region_jar, region);
        vm_area_free(vma);
        pr_warn("Allocation of vma tree for process %d failed\n", current->pid);
-       show_free_areas(0, NULL);
+       show_mem();
        return -ENOMEM;
 
 }
index 01f8e990581734e80299f835fb65e4f65b13519a..09c7d036d49ecb3defa5e872d631551a9c853994 100644 (file)
@@ -186,7 +186,7 @@ static bool node_has_managed_zones(pg_data_t *pgdat, int max_zone_idx)
  * SHOW_MEM_FILTER_NODES: suppress nodes that are not allowed by current's
  *   cpuset.
  */
-void __show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
+static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
 {
        unsigned long free_pcp = 0;
        int cpu, nid;
@@ -406,7 +406,7 @@ void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
        struct zone *zone;
 
        printk("Mem-Info:\n");
-       __show_free_areas(filter, nodemask, max_zone_idx);
+       show_free_areas(filter, nodemask, max_zone_idx);
 
        for_each_populated_zone(zone) {