Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1335226

Re: [PATCHv2 04/28] mm: make remove_migration_ptes() beyond mm/migration.c

From "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCHv2 04/28] mm: make remove_migration_ptes() beyond mm/migration.c
Date 2016-02-16 11:00 +0100
Message-ID <r2KAj-685-35@gated-at.bofh.it> (permalink)
References <r10pQ-1zg-3@gated-at.bofh.it> <r10pT-1zg-83@gated-at.bofh.it> <r1pez-17H-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Feb 12, 2016 at 08:54:58AM -0800, Dave Hansen wrote:
> On 02/11/2016 06:21 AM, Kirill A. Shutemov wrote
> > We also shouldn't try to mlock() pte-mapped huge pages: pte-mapeed THP
> > pages are never mlocked.
> 
> That's kinda subtle.  Can you explain more?
> 
> If we did the following:
> 
> 	ptr = mmap(NULL, 512*PAGE_SIZE, ...);
> 	mlock(ptr, 512*PAGE_SIZE);
> 	fork();
> 	munmap(ptr + 100 * PAGE_SIZE, PAGE_SIZE);
> 
> I'd expect to get two processes, each mapping the same compound THP, one
> with a PMD and the other with 511 ptes and one hole.  Is there something
> different that goes on?

I'm not sure what exactly you want to ask with this code, but it will have
the following result:

 - After fork() process will split the pmd in munlock(). For file thp
   split pmd, means clear it out. Mapping split_huge_pmd() would munlock
   the page as we do for anon thp;

 - In child process the page is never mapped as mlock() is not inherited
   and we don't copy page tables for shared VMA as they can re-faulted
   later;

The basic semantic for mlock()ed file THP would be the same as for anon
THP: we only keep the page mlocked as long as it's mapped only with PMDs.
This way it's relatively simple to make sure that we don't leak mlocked
pages.

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 04/28] mm: make remove_migration_ptes() beyond mm/migration.c "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-02-11 15:30 +0100
  Re: [PATCHv2 04/28] mm: make remove_migration_ptes() beyond  mm/migration.c Dave Hansen <dave.hansen@intel.com> - 2016-02-12 18:00 +0100
    Re: [PATCHv2 04/28] mm: make remove_migration_ptes() beyond  mm/migration.c "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-02-16 11:00 +0100
      Re: [PATCHv2 04/28] mm: make remove_migration_ptes() beyond  mm/migration.c Dave Hansen <dave.hansen@intel.com> - 2016-02-16 16:40 +0100

csiph-web