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?

