lkml.org 
[lkml]   [2018]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv5 06/19] mm/khugepaged: Handle encrypted pages
On Wed, Jul 18, 2018 at 04:11:57PM -0700, Dave Hansen wrote:
> On 07/17/2018 04:20 AM, Kirill A. Shutemov wrote:
> > khugepaged allocates page in advance, before we found a VMA for
> > collapse. We don't yet know which KeyID to use for the allocation.
>
> That's not really true. We have the VMA and the address in the caller
> (khugepaged_scan_pmd()), but we drop the lock and have to revalidate the
> VMA.

For !NUMA we allocate the page in khugepaged_do_scan(), well before we
know VMA.

>
>
> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> > index 5ae34097aed1..d116f4ebb622 100644
> > --- a/mm/khugepaged.c
> > +++ b/mm/khugepaged.c
> > @@ -1056,6 +1056,16 @@ static void collapse_huge_page(struct mm_struct *mm,
> > */
> > anon_vma_unlock_write(vma->anon_vma);
> >
> > + /*
> > + * At this point new_page is allocated as non-encrypted.
> > + * If VMA's KeyID is non-zero, we need to prepare it to be encrypted
> > + * before coping data.
> > + */
> > + if (vma_keyid(vma)) {
> > + prep_encrypted_page(new_page, HPAGE_PMD_ORDER,
> > + vma_keyid(vma), false);
> > + }
>
> I guess this isn't horribly problematic now, but if we ever keep pools
> of preassigned-keyids, this won't work any more.

I don't get this. What pools of preassigned-keyids are you talking about?

--
Kirill A. Shutemov

\
 
 \ /
  Last update: 2018-07-19 10:59    [W:0.411 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site