Skip to content

Commit 7a27ef5

Browse files
joergroedelIngo Molnar
authored andcommitted
x86/mm/64: Update comment in preallocate_vmalloc_pages()
The comment explaining why 4-level systems only need to allocate on the P4D level caused some confustion. Update it to better explain why on 4-level systems the allocation on PUD level is necessary. Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 58a18fe commit 7a27ef5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/x86/mm/init_64.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,14 +1252,19 @@ static void __init preallocate_vmalloc_pages(void)
12521252
if (!p4d)
12531253
goto failed;
12541254

1255-
/*
1256-
* With 5-level paging the P4D level is not folded. So the PGDs
1257-
* are now populated and there is no need to walk down to the
1258-
* PUD level.
1259-
*/
12601255
if (pgtable_l5_enabled())
12611256
continue;
12621257

1258+
/*
1259+
* The goal here is to allocate all possibly required
1260+
* hardware page tables pointed to by the top hardware
1261+
* level.
1262+
*
1263+
* On 4-level systems, the P4D layer is folded away and
1264+
* the above code does no preallocation. Below, go down
1265+
* to the pud _software_ level to ensure the second
1266+
* hardware level is allocated on 4-level systems too.
1267+
*/
12631268
lvl = "pud";
12641269
pud = pud_alloc(&init_mm, p4d, addr);
12651270
if (!pud)

0 commit comments

Comments
 (0)