Skip to content

Commit

Permalink
Merge tag 'x86-urgent-2022-05-15' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/tip/tip

Pull x86 fix from Thomas Gleixner:
 "A single fix for the handling of unpopulated sub-pmd spaces.

  The copy & pasta from the corresponding s390 code screwed up the
  address calculation for marking the sub-pmd ranges via memset by
  omitting the ALIGN_DOWN() to calculate the proper start address.

  It's a mystery why this code is not generic and shared because there
  is nothing architecture specific in there, but that's too intrusive
  for a backportable fix"

* tag 'x86-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mm: Fix marking of unused sub-pmd ranges
  • Loading branch information
Linus Torvalds committed May 15, 2022
2 parents 990e798 + 280abe1 commit 79dc4fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,8 @@ static void __meminit vmemmap_use_sub_pmd(unsigned long start, unsigned long end

static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long end)
{
const unsigned long page = ALIGN_DOWN(start, PMD_SIZE);

vmemmap_flush_unused_pmd();

/*
Expand All @@ -914,8 +916,7 @@ static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long
* Mark with PAGE_UNUSED the unused parts of the new memmap range
*/
if (!IS_ALIGNED(start, PMD_SIZE))
memset((void *)start, PAGE_UNUSED,
start - ALIGN_DOWN(start, PMD_SIZE));
memset((void *)page, PAGE_UNUSED, start - page);

/*
* We want to avoid memset(PAGE_UNUSED) when populating the vmemmap of
Expand Down

0 comments on commit 79dc4fc

Please sign in to comment.