summaryrefslogtreecommitdiffstats
path: root/mm/huge_memory.c
diff options
context:
space:
mode:
authorKirill A. Shutemov2016-07-27 00:26:18 +0200
committerLinus Torvalds2016-07-27 01:19:19 +0200
commit800d8c63b2e989c2e349632d1648119bf5862f01 (patch)
tree8f72ce10bcdc01f17a5e8f2197ae4858fbab6bd4 /mm/huge_memory.c
parentshmem: get_unmapped_area align huge page (diff)
downloadkernel-qcow2-linux-800d8c63b2e989c2e349632d1648119bf5862f01.tar.gz
kernel-qcow2-linux-800d8c63b2e989c2e349632d1648119bf5862f01.tar.xz
kernel-qcow2-linux-800d8c63b2e989c2e349632d1648119bf5862f01.zip
shmem: add huge pages support
Here's basic implementation of huge pages support for shmem/tmpfs. It's all pretty streight-forward: - shmem_getpage() allcoates huge page if it can and try to inserd into radix tree with shmem_add_to_page_cache(); - shmem_add_to_page_cache() puts the page onto radix-tree if there's space for it; - shmem_undo_range() removes huge pages, if it fully within range. Partial truncate of huge pages zero out this part of THP. This have visible effect on fallocate(FALLOC_FL_PUNCH_HOLE) behaviour. As we don't really create hole in this case, lseek(SEEK_HOLE) may have inconsistent results depending what pages happened to be allocated. - no need to change shmem_fault: core-mm will map an compound page as huge if VMA is suitable; Link: http://lkml.kernel.org/r/1466021202-61880-30-git-send-email-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r--mm/huge_memory.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index cabd53dac5b9..0f58460cd69c 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3316,6 +3316,8 @@ static void __split_huge_page(struct page *page, struct list_head *list,
if (head[i].index >= end) {
__ClearPageDirty(head + i);
__delete_from_page_cache(head + i, NULL);
+ if (IS_ENABLED(CONFIG_SHMEM) && PageSwapBacked(head))
+ shmem_uncharge(head->mapping->host, 1);
put_page(head + i);
}
}