Skip to content

Commit 3de360c

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/mm: drop HAVE_ARCH_PFN_VALID
CONFIG_SPARSEMEM_VMEMMAP is now the only available memory model on arm64 platforms and free_unused_memmap() would just return without creating any holes in the memmap mapping. There is no need for any special handling in pfn_valid() and HAVE_ARCH_PFN_VALID can just be dropped. This also moves the pfn upper bits sanity check into generic pfn_valid(). [rppt: rebased on v5.15-rc3] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Anshuman Khandual <[email protected]> Acked-by: David Hildenbrand <[email protected]> Acked-by: Mike Rapoport <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Mike Rapoport <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Mike Rapoport <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent a9c38c5 commit 3de360c

File tree

3 files changed

+0
-39
lines changed

3 files changed

+0
-39
lines changed

arch/arm64/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ config ARM64
154154
select HAVE_ARCH_KGDB
155155
select HAVE_ARCH_MMAP_RND_BITS
156156
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
157-
select HAVE_ARCH_PFN_VALID
158157
select HAVE_ARCH_PREL32_RELOCATIONS
159158
select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
160159
select HAVE_ARCH_SECCOMP_FILTER

arch/arm64/include/asm/page.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ void tag_clear_highpage(struct page *to);
4141

4242
typedef struct page *pgtable_t;
4343

44-
int pfn_valid(unsigned long pfn);
4544
int pfn_is_map_memory(unsigned long pfn);
4645

4746
#include <asm/memory.h>

arch/arm64/mm/init.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -160,43 +160,6 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
160160
free_area_init(max_zone_pfns);
161161
}
162162

163-
int pfn_valid(unsigned long pfn)
164-
{
165-
phys_addr_t addr = PFN_PHYS(pfn);
166-
struct mem_section *ms;
167-
168-
/*
169-
* Ensure the upper PAGE_SHIFT bits are clear in the
170-
* pfn. Else it might lead to false positives when
171-
* some of the upper bits are set, but the lower bits
172-
* match a valid pfn.
173-
*/
174-
if (PHYS_PFN(addr) != pfn)
175-
return 0;
176-
177-
if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
178-
return 0;
179-
180-
ms = __pfn_to_section(pfn);
181-
if (!valid_section(ms))
182-
return 0;
183-
184-
/*
185-
* ZONE_DEVICE memory does not have the memblock entries.
186-
* memblock_is_map_memory() check for ZONE_DEVICE based
187-
* addresses will always fail. Even the normal hotplugged
188-
* memory will never have MEMBLOCK_NOMAP flag set in their
189-
* memblock entries. Skip memblock search for all non early
190-
* memory sections covering all of hotplug memory including
191-
* both normal and ZONE_DEVICE based.
192-
*/
193-
if (!early_section(ms))
194-
return pfn_section_valid(ms, pfn);
195-
196-
return memblock_is_memory(addr);
197-
}
198-
EXPORT_SYMBOL(pfn_valid);
199-
200163
int pfn_is_map_memory(unsigned long pfn)
201164
{
202165
phys_addr_t addr = PFN_PHYS(pfn);

0 commit comments

Comments
 (0)