Skip to content

Commit

Permalink
mm: make arch_has_descending_max_zone_pfns() static
Browse files Browse the repository at this point in the history
clang produces a build failure on x86 for some randconfig builds after a
change that moves around code to mm/mm_init.c:

Cannot find symbol for section 2: .text.
mm/mm_init.o: failed

I have not been able to figure out why this happens, but the __weak
annotation on arch_has_descending_max_zone_pfns() is the trigger here.

Removing the weak function in favor of an open-coded Kconfig option check
avoids the problem and becomes clearer as well as better to optimize by
the compiler.

[[email protected]: fix logic bug]
  Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 9420f89 ("mm: move most of core MM initialization to mm/mm_init.c")
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Tested-by: SeongJae Park <[email protected]>
Tested-by: Geert Uytterhoeven <[email protected]>
Acked-by: Mike Rapoport (IBM) <[email protected]>
Cc: kernel test robot <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
arndb authored and akpm00 committed Apr 18, 2023
1 parent 59f876f commit 5f300fd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
5 changes: 0 additions & 5 deletions arch/arc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
base, TO_MB(size), !in_use ? "Not used":"");
}

bool arch_has_descending_max_zone_pfns(void)
{
return !IS_ENABLED(CONFIG_ARC_HAS_PAE40);
}

/*
* First memory setup routine called from setup_arch()
* 1. setup swapper's mm @init_mm
Expand Down
1 change: 0 additions & 1 deletion include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3035,7 +3035,6 @@ extern void setup_per_cpu_pageset(void);
extern int min_free_kbytes;
extern int watermark_boost_factor;
extern int watermark_scale_factor;
extern bool arch_has_descending_max_zone_pfns(void);

/* nommu.c */
extern atomic_long_t mmap_pages_allocated;
Expand Down
4 changes: 2 additions & 2 deletions mm/mm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1752,9 +1752,9 @@ static void __init free_area_init_memoryless_node(int nid)
* Some architectures, e.g. ARC may have ZONE_HIGHMEM below ZONE_NORMAL. For
* such cases we allow max_zone_pfn sorted in the descending order
*/
bool __weak arch_has_descending_max_zone_pfns(void)
static bool arch_has_descending_max_zone_pfns(void)
{
return false;
return IS_ENABLED(CONFIG_ARC) && !IS_ENABLED(CONFIG_ARC_HAS_PAE40);
}

/**
Expand Down

0 comments on commit 5f300fd

Please sign in to comment.