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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmKAxpUTHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYoce3EACRBl9gb+3gU/qXcjyM09AaqIYo084t
 ewJnbsmvM7y0zCqgEKB7TKzQ7DEcrzz+woATWkEI3WiC12SYh3OAd8MfoTkp9p3n
 RlGtlqXozus0fppbkiXUyrOcWZjAFsTXpKNqZr1xTDaAJjQYlhgZKo7kedUDhe2N
 5IX5ss/cZM/mnUR+AFY55jQR6pEnMY3qjC5vTVd/nqPIo8T6ZvLmmXdm8HnF1f+Y
 a64h9PpvjOHfGw+ljFaMUtIH6JEpyIomai1VUFbhYyaiTVFI2AZVkvuHS2Pg18/R
 NPWDjNozd9PBRlYcvXWmFyNCe4CuCAq6hy3IctVUUINVg7+/68mRoLxnFaWYaQcx
 dl1bUE0F6I1XWRxLMx7uUWHffVyY8bomPB2koNII+AqgMOoKaUT1pNWPQzSQw0aw
 Etjb2pVj9sfJ84VOfzlh7SObAU/Bf7lCXNUpNXvEPH71L/B4cIe+XpvWgNB1Ezpz
 gXX6TLxmlPnwJokmeQ/gnO+bWGsjBRNu+cCsLHu2MGFuFJyPePhBMNvfnBv/A0jG
 9lTq9zztiWJO2iu/TC/wRA21SBMvmipz23DIdv5Jhl0b+mP/qOSPQpZu9P3bRPIu
 C4X8nQLP4DDF4juRJtgFqKdfI9A9h50phnvrOaOPn7Lnrx99Hbg0/2h9bU7lA2Ly
 qe9+nz/i5CAC6w==
 =f+jf
 -----END PGP SIGNATURE-----

Merge tag 'x86-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/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
This commit is contained in:
Linus Torvalds 2022-05-15 06:42:40 -07:00
commit 79dc4fc2f2

View file

@ -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();
/*
@ -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