lkml.org 
[lkml]   [2018]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch V3 08/11] x86/mm/cpa: Add sanity check for existing mappings
From
Date
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>

\
 
 \ /
  Last update: 2018-09-21 22:08    [W:0.185 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site