• Collin Fijalkovich's avatar
    mm, thp: relax the VM_DENYWRITE constraint on file-backed THPs · eb6ecbed
    Collin Fijalkovich authored
    Transparent huge pages are supported for read-only non-shmem files, but
    are only used for vmas with VM_DENYWRITE.  This condition ensures that
    file THPs are protected from writes while an application is running
    (ETXTBSY).  Any existing file THPs are then dropped from the page cache
    when a file is opened for write in do_dentry_open().  Since sys_mmap
    ignores MAP_DENYWRITE, this constrains the use of file THPs to vmas
    produced by execve().
    
    Systems that make heavy use of shared libraries (e.g.  Android) are unable
    to apply VM_DENYWRITE through the dynamic linker, preventing them from
    benefiting from the resultant reduced contention on the TLB.
    
    This patch reduces the constraint on file THPs allowing use with any
    executable mapping from a file not opened for write (see
    inode_is_open_for_write()).  It also introduces additional conditions to
    ensure that files opened for write will never be backed by file THPs.
    
    Restricting the use of THPs to execu...
    eb6ecbed
khugepaged.c 59.3 KB