Skip to content

Commit dc6bab1

Browse files
committed
Merge branch 'for-next/mm' into for-next/core
* for-next/mm: arm64: mm: update max_pfn after memory hotplug arm64/mm: Add pud_sect_supported() arm64: mm: Drop pointless call to set_max_mapnr()
2 parents 2bc655c + 8fac67c commit dc6bab1

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,11 @@ static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
10221022
return PAGE_READONLY_EXEC;
10231023
}
10241024

1025+
static inline bool pud_sect_supported(void)
1026+
{
1027+
return PAGE_SIZE == SZ_4K;
1028+
}
1029+
10251030

10261031
#endif /* !__ASSEMBLY__ */
10271032

arch/arm64/include/asm/vmalloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
#define _ASM_ARM64_VMALLOC_H
33

44
#include <asm/page.h>
5+
#include <asm/pgtable.h>
56

67
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
78

89
#define arch_vmap_pud_supported arch_vmap_pud_supported
910
static inline bool arch_vmap_pud_supported(pgprot_t prot)
1011
{
1112
/*
12-
* Only 4k granule supports level 1 block mappings.
1313
* SW table walks can't handle removal of intermediate entries.
1414
*/
15-
return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
15+
return pud_sect_supported() &&
1616
!IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
1717
}
1818

arch/arm64/mm/hugetlbpage.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ void __init arm64_hugetlb_cma_reserve(void)
4040
{
4141
int order;
4242

43-
#ifdef CONFIG_ARM64_4K_PAGES
44-
order = PUD_SHIFT - PAGE_SHIFT;
45-
#else
46-
order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT;
47-
#endif
43+
if (pud_sect_supported())
44+
order = PUD_SHIFT - PAGE_SHIFT;
45+
else
46+
order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT;
4847
/*
4948
* HugeTLB CMA reservation is required for gigantic
5049
* huge pages which could not be allocated via the
@@ -62,8 +61,9 @@ bool arch_hugetlb_migration_supported(struct hstate *h)
6261
size_t pagesize = huge_page_size(h);
6362

6463
switch (pagesize) {
65-
#ifdef CONFIG_ARM64_4K_PAGES
64+
#ifndef __PAGETABLE_PMD_FOLDED
6665
case PUD_SIZE:
66+
return pud_sect_supported();
6767
#endif
6868
case PMD_SIZE:
6969
case CONT_PMD_SIZE:
@@ -126,8 +126,11 @@ static inline int num_contig_ptes(unsigned long size, size_t *pgsize)
126126
*pgsize = size;
127127

128128
switch (size) {
129-
#ifdef CONFIG_ARM64_4K_PAGES
129+
#ifndef __PAGETABLE_PMD_FOLDED
130130
case PUD_SIZE:
131+
if (pud_sect_supported())
132+
contig_ptes = 1;
133+
break;
131134
#endif
132135
case PMD_SIZE:
133136
contig_ptes = 1;
@@ -489,9 +492,9 @@ void huge_ptep_clear_flush(struct vm_area_struct *vma,
489492

490493
static int __init hugetlbpage_init(void)
491494
{
492-
#ifdef CONFIG_ARM64_4K_PAGES
493-
hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
494-
#endif
495+
if (pud_sect_supported())
496+
hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
497+
495498
hugetlb_add_hstate(CONT_PMD_SHIFT - PAGE_SHIFT);
496499
hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
497500
hugetlb_add_hstate(CONT_PTE_SHIFT - PAGE_SHIFT);
@@ -503,8 +506,9 @@ arch_initcall(hugetlbpage_init);
503506
bool __init arch_hugetlb_valid_size(unsigned long size)
504507
{
505508
switch (size) {
506-
#ifdef CONFIG_ARM64_4K_PAGES
509+
#ifndef __PAGETABLE_PMD_FOLDED
507510
case PUD_SIZE:
511+
return pud_sect_supported();
508512
#endif
509513
case CONT_PMD_SIZE:
510514
case PMD_SIZE:

arch/arm64/mm/init.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ void __init mem_init(void)
416416
else if (!xen_swiotlb_detect())
417417
swiotlb_force = SWIOTLB_NO_FORCE;
418418

419-
set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
420-
421419
/* this will put all unused low memory onto the freelists */
422420
memblock_free_all();
423421

arch/arm64/mm/mmu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,11 @@ int arch_add_memory(int nid, u64 start, u64 size,
14991499
if (ret)
15001500
__remove_pgd_mapping(swapper_pg_dir,
15011501
__phys_to_virt(start), size);
1502+
else {
1503+
max_pfn = PFN_UP(start + size);
1504+
max_low_pfn = max_pfn;
1505+
}
1506+
15021507
return ret;
15031508
}
15041509

0 commit comments

Comments
 (0)