Re: [PATCH v2 2/2] mm,thp: Add experimental config option RO_EXEC_FILEMAP_HUGE_FAULT_THP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 29, 2019 at 2:10 PM William Kucharski
<william.kucharski@xxxxxxxxxx> wrote:
>
> Add filemap_huge_fault() to attempt to satisfy page faults on
> memory-mapped read-only text pages using THP when possible.
>
> Signed-off-by: William Kucharski <william.kucharski@xxxxxxxxxx>
[..]
> +/**
> + * filemap_huge_fault - read in file data for page fault handling to THP
> + * @vmf:       struct vm_fault containing details of the fault
> + * @pe_size:   large page size to map, currently this must be PE_SIZE_PMD
> + *
> + * filemap_huge_fault() is invoked via the vma operations vector for a
> + * mapped memory region to read in file data to a transparent huge page during
> + * a page fault.
> + *
> + * If for any reason we can't allocate a THP, map it or add it to the page
> + * cache, VM_FAULT_FALLBACK will be returned which will cause the fault
> + * handler to try mapping the page using a PAGESIZE page, usually via
> + * filemap_fault() if so speicifed in the vma operations vector.
> + *
> + * Returns either VM_FAULT_FALLBACK or the result of calling allcc_set_pte()
> + * to map the new THP.
> + *
> + * NOTE: This routine depends upon the file system's readpage routine as
> + *       specified in the address space operations vector to recognize when it
> + *      is being passed a large page and to read the approprate amount of data
> + *      in full and without polluting the page cache for the large page itself
> + *      with PAGESIZE pages to perform a buffered read or to pollute what
> + *      would be the page cache space for any succeeding pages with PAGESIZE
> + *      pages due to readahead.
> + *
> + *      It is VITAL that this routine not be enabled without such filesystem
> + *      support.

Rather than a hopeful comment, this wants an explicit mechanism to
prevent inadvertent mismatched ->readpage() assumptions. Either a new
->readhugepage() op, or a flags field in 'struct
address_space_operations' indicating that the address_space opts into
being careful to handle huge page arguments. I.e. something like
mmap_supported_flags that was added to 'struct file_operations'.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux