Skip to content

Commit 280abe1

Browse files
KensanKAGA-KOKO
authored andcommitted
x86/mm: Fix marking of unused sub-pmd ranges
The unused part precedes the new range spanned by the start, end parameters of vmemmap_use_new_sub_pmd(). This means it actually goes from ALIGN_DOWN(start, PMD_SIZE) up to start. Use the correct address when applying the mark using memset. Fixes: 8d40091 ("x86/vmemmap: handle unpopulated sub-pmd ranges") Signed-off-by: Adrian-Ken Rueegsegger <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Oscar Salvador <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent c5eb0a6 commit 280abe1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/x86/mm/init_64.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,8 @@ static void __meminit vmemmap_use_sub_pmd(unsigned long start, unsigned long end
902902

903903
static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long end)
904904
{
905+
const unsigned long page = ALIGN_DOWN(start, PMD_SIZE);
906+
905907
vmemmap_flush_unused_pmd();
906908

907909
/*
@@ -914,8 +916,7 @@ static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long
914916
* Mark with PAGE_UNUSED the unused parts of the new memmap range
915917
*/
916918
if (!IS_ALIGNED(start, PMD_SIZE))
917-
memset((void *)start, PAGE_UNUSED,
918-
start - ALIGN_DOWN(start, PMD_SIZE));
919+
memset((void *)page, PAGE_UNUSED, start - page);
919920

920921
/*
921922
* We want to avoid memset(PAGE_UNUSED) when populating the vmemmap of

0 commit comments

Comments
 (0)