Skip to content

Commit e5d248c

Browse files
author
Herton R. Krzesinski
committed
Merge: mm/nvdimm: fix failure to install os on some ppc systems
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2836 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2217652 Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Approved-by: Prarit Bhargava <prarit@redhat.com> Approved-by: Rafael Aquini <aquini@redhat.com> Approved-by: Chris von Recklinghausen <crecklin@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents fbe450b + 6c5dd27 commit e5d248c

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ config X86
123123
select ARCH_WANTS_NO_INSTR
124124
select ARCH_WANT_GENERAL_HUGETLB
125125
select ARCH_WANT_HUGE_PMD_SHARE
126-
select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP if X86_64
127126
select ARCH_WANT_LD_ORPHAN_WARN
127+
select ARCH_WANT_OPTIMIZE_VMEMMAP if X86_64
128128
select ARCH_WANTS_THP_SWAP if X86_64
129129
select ARCH_HAS_PARANOID_L1D_FLUSH
130130
select BUILDTIME_TABLE_SORT

fs/Kconfig

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,9 @@ config HUGETLBFS
245245
config HUGETLB_PAGE
246246
def_bool HUGETLBFS
247247

248-
#
249-
# Select this config option from the architecture Kconfig, if it is preferred
250-
# to enable the feature of HugeTLB Vmemmap Optimization (HVO).
251-
#
252-
config ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
253-
bool
254-
255248
config HUGETLB_PAGE_OPTIMIZE_VMEMMAP
256249
def_bool HUGETLB_PAGE
257-
depends on ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
250+
depends on ARCH_WANT_OPTIMIZE_VMEMMAP
258251
depends on SPARSEMEM_VMEMMAP
259252

260253
config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON

include/linux/mm.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,6 +3239,22 @@ void vmemmap_populate_print_last(void);
32393239
void vmemmap_free(unsigned long start, unsigned long end,
32403240
struct vmem_altmap *altmap);
32413241
#endif
3242+
3243+
#ifdef CONFIG_ARCH_WANT_OPTIMIZE_VMEMMAP
3244+
static inline bool vmemmap_can_optimize(struct vmem_altmap *altmap,
3245+
struct dev_pagemap *pgmap)
3246+
{
3247+
return is_power_of_2(sizeof(struct page)) &&
3248+
pgmap && (pgmap_vmemmap_nr(pgmap) > 1) && !altmap;
3249+
}
3250+
#else
3251+
static inline bool vmemmap_can_optimize(struct vmem_altmap *altmap,
3252+
struct dev_pagemap *pgmap)
3253+
{
3254+
return false;
3255+
}
3256+
#endif
3257+
32423258
void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
32433259
unsigned long nr_pages);
32443260

mm/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,12 @@ config SPARSEMEM_VMEMMAP
440440
SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
441441
pfn_to_page and page_to_pfn operations. This is the most
442442
efficient option when sufficient kernel resources are available.
443+
#
444+
# Select this config option from the architecture Kconfig, if it is preferred
445+
# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
446+
#
447+
config ARCH_WANT_OPTIMIZE_VMEMMAP
448+
bool
443449

444450
config HAVE_MEMBLOCK_PHYS_MAP
445451
bool

mm/page_alloc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6842,10 +6842,12 @@ static void __ref __init_zone_device_page(struct page *page, unsigned long pfn,
68426842
* of an altmap. See vmemmap_populate_compound_pages().
68436843
*/
68446844
static inline unsigned long compound_nr_pages(struct vmem_altmap *altmap,
6845-
unsigned long nr_pages)
6845+
struct dev_pagemap *pgmap)
68466846
{
6847-
return is_power_of_2(sizeof(struct page)) &&
6848-
!altmap ? 2 * (PAGE_SIZE / sizeof(struct page)) : nr_pages;
6847+
if (!vmemmap_can_optimize(altmap, pgmap))
6848+
return pgmap_vmemmap_nr(pgmap);
6849+
6850+
return 2 * (PAGE_SIZE / sizeof(struct page));
68496851
}
68506852

68516853
static void __ref memmap_init_compound(struct page *head,
@@ -6912,7 +6914,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
69126914
continue;
69136915

69146916
memmap_init_compound(page, pfn, zone_idx, nid, pgmap,
6915-
compound_nr_pages(altmap, pfns_per_compound));
6917+
compound_nr_pages(altmap, pgmap));
69166918
}
69176919

69186920
pr_info("%s initialised %lu pages in %ums\n", __func__,

mm/sparse-vmemmap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,7 @@ struct page * __meminit __populate_section_memmap(unsigned long pfn,
385385
!IS_ALIGNED(nr_pages, PAGES_PER_SUBSECTION)))
386386
return NULL;
387387

388-
if (is_power_of_2(sizeof(struct page)) &&
389-
pgmap && pgmap_vmemmap_nr(pgmap) > 1 && !altmap)
388+
if (vmemmap_can_optimize(altmap, pgmap))
390389
r = vmemmap_populate_compound_pages(pfn, start, end, nid, pgmap);
391390
else
392391
r = vmemmap_populate(start, end, nid, altmap);

0 commit comments

Comments
 (0)