Skip to content

Commit 5e545df

Browse files
rppttorvalds
authored andcommitted
arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
ARM is the only architecture that defines CONFIG_ARCH_HAS_HOLES_MEMORYMODEL which in turn enables memmap_valid_within() function that is intended to verify existence of struct page associated with a pfn when there are holes in the memory map. However, the ARCH_HAS_HOLES_MEMORYMODEL also enables HAVE_ARCH_PFN_VALID and arch-specific pfn_valid() implementation that also deals with the holes in the memory map. The only two users of memmap_valid_within() call this function after a call to pfn_valid() so the memmap_valid_within() check becomes redundant. Remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL and memmap_valid_within() and rely entirely on ARM's implementation of pfn_valid() that is now enabled unconditionally. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Greg Ungerer <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Matt Turner <[email protected]> Cc: Meelis Roos <[email protected]> Cc: Michael Schmitz <[email protected]> Cc: Russell King <[email protected]> Cc: Tony Luck <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 214496c commit 5e545df

File tree

13 files changed

+3
-66
lines changed

13 files changed

+3
-66
lines changed

Documentation/vm/memory-model.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ call :c:func:`free_area_init` function. Yet, the mappings array is not
5151
usable until the call to :c:func:`memblock_free_all` that hands all the
5252
memory to the page allocator.
5353

54-
If an architecture enables `CONFIG_ARCH_HAS_HOLES_MEMORYMODEL` option,
55-
it may free parts of the `mem_map` array that do not cover the
54+
An architecture may free parts of the `mem_map` array that do not cover the
5655
actual physical pages. In such case, the architecture specific
5756
:c:func:`pfn_valid` implementation should take the holes in the
5857
`mem_map` into account.

arch/arm/Kconfig

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ config ARM
2525
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
2626
select ARCH_HAVE_CUSTOM_GPIO_H
2727
select ARCH_HAS_GCOV_PROFILE_ALL
28-
select ARCH_KEEP_MEMBLOCK if HAVE_ARCH_PFN_VALID || KEXEC
28+
select ARCH_KEEP_MEMBLOCK
2929
select ARCH_MIGHT_HAVE_PC_PARPORT
3030
select ARCH_NO_SG_CHAIN if !ARM_HAS_SG_CHAIN
3131
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
@@ -520,7 +520,6 @@ config ARCH_S3C24XX
520520
config ARCH_OMAP1
521521
bool "TI OMAP1"
522522
depends on MMU
523-
select ARCH_HAS_HOLES_MEMORYMODEL
524523
select ARCH_OMAP
525524
select CLKDEV_LOOKUP
526525
select CLKSRC_MMIO
@@ -1480,9 +1479,6 @@ config OABI_COMPAT
14801479
UNPREDICTABLE (in fact it can be predicted that it won't work
14811480
at all). If in doubt say N.
14821481

1483-
config ARCH_HAS_HOLES_MEMORYMODEL
1484-
bool
1485-
14861482
config ARCH_SELECT_MEMORY_MODEL
14871483
bool
14881484

@@ -1494,7 +1490,7 @@ config ARCH_SPARSEMEM_ENABLE
14941490
select SPARSEMEM_STATIC if SPARSEMEM
14951491

14961492
config HAVE_ARCH_PFN_VALID
1497-
def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM
1493+
def_bool y
14981494

14991495
config HIGHMEM
15001496
bool "High Memory Support"

arch/arm/mach-bcm/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ config ARCH_BRCMSTB
211211
select BCM7038_L1_IRQ
212212
select BRCMSTB_L2_IRQ
213213
select BCM7120_L2_IRQ
214-
select ARCH_HAS_HOLES_MEMORYMODEL
215214
select ZONE_DMA if ARM_LPAE
216215
select SOC_BRCMSTB
217216
select SOC_BUS

arch/arm/mach-davinci/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ menuconfig ARCH_DAVINCI
55
depends on ARCH_MULTI_V5
66
select DAVINCI_TIMER
77
select ZONE_DMA
8-
select ARCH_HAS_HOLES_MEMORYMODEL
98
select PM_GENERIC_DOMAINS if PM
109
select PM_GENERIC_DOMAINS_OF if PM && OF
1110
select REGMAP_MMIO

arch/arm/mach-exynos/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
menuconfig ARCH_EXYNOS
99
bool "Samsung Exynos"
1010
depends on ARCH_MULTI_V7
11-
select ARCH_HAS_HOLES_MEMORYMODEL
1211
select ARCH_SUPPORTS_BIG_ENDIAN
1312
select ARM_AMBA
1413
select ARM_GIC

arch/arm/mach-highbank/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
config ARCH_HIGHBANK
33
bool "Calxeda ECX-1000/2000 (Highbank/Midway)"
44
depends on ARCH_MULTI_V7
5-
select ARCH_HAS_HOLES_MEMORYMODEL
65
select ARCH_SUPPORTS_BIG_ENDIAN
76
select ARM_AMBA
87
select ARM_ERRATA_764369 if SMP

arch/arm/mach-omap2/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ config SOC_DRA7XX
9393
config ARCH_OMAP2PLUS
9494
bool
9595
select ARCH_HAS_BANDGAP
96-
select ARCH_HAS_HOLES_MEMORYMODEL
9796
select ARCH_HAS_RESET_CONTROLLER
9897
select ARCH_OMAP
9998
select CLKSRC_MMIO

arch/arm/mach-s5pv210/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
config ARCH_S5PV210
99
bool "Samsung S5PV210/S5PC110"
1010
depends on ARCH_MULTI_V7
11-
select ARCH_HAS_HOLES_MEMORYMODEL
1211
select ARM_VIC
1312
select CLKSRC_SAMSUNG_PWM
1413
select COMMON_CLK_SAMSUNG

arch/arm/mach-tango/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ config ARCH_TANGO
33
bool "Sigma Designs Tango4 (SMP87xx)"
44
depends on ARCH_MULTI_V7
55
# Cortex-A9 MPCore r3p0, PL310 r3p2
6-
select ARCH_HAS_HOLES_MEMORYMODEL
76
select ARM_ERRATA_754322
87
select ARM_ERRATA_764369 if SMP
98
select ARM_ERRATA_775420

fs/proc/kcore.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ kclist_add_private(unsigned long pfn, unsigned long nr_pages, void *arg)
193193
return 1;
194194

195195
p = pfn_to_page(pfn);
196-
if (!memmap_valid_within(pfn, p, page_zone(p)))
197-
return 1;
198196

199197
ent = kmalloc(sizeof(*ent), GFP_KERNEL);
200198
if (!ent)

include/linux/mmzone.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,37 +1440,6 @@ void sparse_init(void);
14401440
#define pfn_valid_within(pfn) (1)
14411441
#endif
14421442

1443-
#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
1444-
/*
1445-
* pfn_valid() is meant to be able to tell if a given PFN has valid memmap
1446-
* associated with it or not. This means that a struct page exists for this
1447-
* pfn. The caller cannot assume the page is fully initialized in general.
1448-
* Hotplugable pages might not have been onlined yet. pfn_to_online_page()
1449-
* will ensure the struct page is fully online and initialized. Special pages
1450-
* (e.g. ZONE_DEVICE) are never onlined and should be treated accordingly.
1451-
*
1452-
* In FLATMEM, it is expected that holes always have valid memmap as long as
1453-
* there is valid PFNs either side of the hole. In SPARSEMEM, it is assumed
1454-
* that a valid section has a memmap for the entire section.
1455-
*
1456-
* However, an ARM, and maybe other embedded architectures in the future
1457-
* free memmap backing holes to save memory on the assumption the memmap is
1458-
* never used. The page_zone linkages are then broken even though pfn_valid()
1459-
* returns true. A walker of the full memmap must then do this additional
1460-
* check to ensure the memmap they are looking at is sane by making sure
1461-
* the zone and PFN linkages are still valid. This is expensive, but walkers
1462-
* of the full memmap are extremely rare.
1463-
*/
1464-
bool memmap_valid_within(unsigned long pfn,
1465-
struct page *page, struct zone *zone);
1466-
#else
1467-
static inline bool memmap_valid_within(unsigned long pfn,
1468-
struct page *page, struct zone *zone)
1469-
{
1470-
return true;
1471-
}
1472-
#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
1473-
14741443
#endif /* !__GENERATING_BOUNDS.H */
14751444
#endif /* !__ASSEMBLY__ */
14761445
#endif /* _LINUX_MMZONE_H */

mm/mmzone.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,6 @@ struct zoneref *__next_zones_zonelist(struct zoneref *z,
7272
return z;
7373
}
7474

75-
#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
76-
bool memmap_valid_within(unsigned long pfn,
77-
struct page *page, struct zone *zone)
78-
{
79-
if (page_to_pfn(page) != pfn)
80-
return false;
81-
82-
if (page_zone(page) != zone)
83-
return false;
84-
85-
return true;
86-
}
87-
#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
88-
8975
void lruvec_init(struct lruvec *lruvec)
9076
{
9177
enum lru_list lru;

mm/vmstat.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,10 +1503,6 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,
15031503
if (!page)
15041504
continue;
15051505

1506-
/* Watch for unexpected holes punched in the memmap */
1507-
if (!memmap_valid_within(pfn, page, zone))
1508-
continue;
1509-
15101506
if (page_zone(page) != zone)
15111507
continue;
15121508

0 commit comments

Comments
 (0)