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

From: Dave Hansen
Date: Fri Feb 12 2016 - 11:55:26 EST


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?