| Subject | Re: [patch V3 08/11] x86/mm/cpa: Add sanity check for existing mappings | From | Dave Hansen <> | Date | Fri, 21 Sep 2018 13:07:24 -0700 |
| |
On 09/17/2018 07:29 AM, Thomas Gleixner wrote: > + /* > + * If this is splitting a PMD, fix it up. PUD splits cannot be > + * fixed trivially as that would require to rescan the newly > + * installed PMD mappings after returning from split_large_page() > + * so an eventual further split can allocate the necessary PTE > + * pages. Warn for now and revisit it in case this actually > + * happens. > + */ > + if (size == PAGE_SIZE) > + ref_prot = prot; > + else > + pr_warn_once("CPA: Cannot fixup static protections for PUD split\n"); > +set: > + set_pte(pte, pfn_pte(pfn, ref_prot)); > +}
This looked a _little_ bit funky to me. It talks about splitting up PMDs and PUDs, but it wasn't immediately obvious why it never looks for PMD or PUD sizes.
It's because split_set_pte()'s "size" is the size we are splitting *to*. IOW, a PMD split gets PAGE_SIZE and a PUD split gets PMD_SIZE. It's obvious with a bit more context, so it might be handy to include a blurb in the comment about what 'size' is *of*.
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
|