Skip to content

Commit 5b14291

Browse files
committed
Merge: Updates for radix vmemmap
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7103 Description: Updates for radix vmemmap JIRA: https://issues.redhat.com/browse/RHEL-99806 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=68185751 Tested: Verified Brew build test kernel RPMs Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Waiman Long <longman@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents 133889d + 104a095 commit 5b14291

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

arch/powerpc/mm/book3s64/radix_pgtable.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,14 +1003,15 @@ int __meminit radix__vmemmap_create_mapping(unsigned long start,
10031003
return 0;
10041004
}
10051005

1006-
1006+
#ifdef CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
10071007
bool vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap)
10081008
{
10091009
if (radix_enabled())
10101010
return __vmemmap_can_optimize(altmap, pgmap);
10111011

10121012
return false;
10131013
}
1014+
#endif
10141015

10151016
int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
10161017
unsigned long addr, unsigned long next)
@@ -1147,6 +1148,19 @@ int __meminit radix__vmemmap_populate(unsigned long start, unsigned long end, in
11471148
pmd_t *pmd;
11481149
pte_t *pte;
11491150

1151+
/*
1152+
* Make sure we align the start vmemmap addr so that we calculate
1153+
* the correct start_pfn in altmap boundary check to decided whether
1154+
* we should use altmap or RAM based backing memory allocation. Also
1155+
* the address need to be aligned for set_pte operation.
1156+
1157+
* If the start addr is already PMD_SIZE aligned we will try to use
1158+
* a pmd mapping. We don't want to be too aggressive here beacause
1159+
* that will cause more allocations in RAM. So only if the namespace
1160+
* vmemmap start addr is PMD_SIZE aligned we will use PMD mapping.
1161+
*/
1162+
1163+
start = ALIGN_DOWN(start, PAGE_SIZE);
11501164
for (addr = start; addr < end; addr = next) {
11511165
next = pmd_addr_end(addr, end);
11521166

@@ -1172,8 +1186,8 @@ int __meminit radix__vmemmap_populate(unsigned long start, unsigned long end, in
11721186
* in altmap block allocation failures, in which case
11731187
* we fallback to RAM for vmemmap allocation.
11741188
*/
1175-
if (altmap && (!IS_ALIGNED(addr, PMD_SIZE) ||
1176-
altmap_cross_boundary(altmap, addr, PMD_SIZE))) {
1189+
if (!IS_ALIGNED(addr, PMD_SIZE) || (altmap &&
1190+
altmap_cross_boundary(altmap, addr, PMD_SIZE))) {
11771191
/*
11781192
* make sure we don't create altmap mappings
11791193
* covering things outside the device.

0 commit comments

Comments
 (0)