]> Git Repo - linux.git/commit
mm,thp: add read-only THP support for (non-shmem) FS
authorSong Liu <[email protected]>
Mon, 23 Sep 2019 22:38:00 +0000 (15:38 -0700)
committerLinus Torvalds <[email protected]>
Tue, 24 Sep 2019 22:54:11 +0000 (15:54 -0700)
commit99cb0dbd47a15d395bf3faa78dc122bc5efe3fc0
tree58e5902f24cd4a5b024152f5bd42a3589ff431cb
parent579c571e2efdb8e5b50959ae66b6142e05bd704f
mm,thp: add read-only THP support for (non-shmem) FS

This patch is (hopefully) the first step to enable THP for non-shmem
filesystems.

This patch enables an application to put part of its text sections to THP
via madvise, for example:

    madvise((void *)0x600000, 0x200000, MADV_HUGEPAGE);

We tried to reuse the logic for THP on tmpfs.

Currently, write is not supported for non-shmem THP.  khugepaged will only
process vma with VM_DENYWRITE.  sys_mmap() ignores VM_DENYWRITE requests
(see ksys_mmap_pgoff).  The only way to create vma with VM_DENYWRITE is
execve().  This requirement limits non-shmem THP to text sections.

The next patch will handle writes, which would only happen when the all
the vmas with VM_DENYWRITE are unmapped.

An EXPERIMENTAL config, READ_ONLY_THP_FOR_FS, is added to gate this
feature.

[[email protected]: fix build without CONFIG_SHMEM]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected]: fix double unlock in collapse_file()]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Song Liu <[email protected]>
Acked-by: Rik van Riel <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: Stephen Rothwell <[email protected]>
Cc: Dan Carpenter <[email protected]>
Cc: Hillf Danton <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: William Kucharski <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/Kconfig
mm/filemap.c
mm/khugepaged.c
mm/rmap.c
This page took 0.058702 seconds and 4 git commands to generate.