>From inode, mark to enable thp in the page cache for tmpfs

Signed-off-by: Ning Qu <qun...@gmail.com>
---
 mm/Kconfig | 4 ++--
 mm/shmem.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/Kconfig b/mm/Kconfig
index 562f12f..4d2f90f 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -428,8 +428,8 @@ config TRANSPARENT_HUGEPAGE_PAGECACHE
        help
          Enabling the option adds support hugepages for file-backed
          mappings. It requires transparent hugepage support from
-         filesystem side. For now, the only filesystem which supports
-         hugepages is ramfs.
+         filesystem side. For now, the filesystems which support
+         hugepages are: ramfs and tmpfs.

 config CROSS_MEMORY_ATTACH
        bool "Cross Memory Support"
diff --git a/mm/shmem.c b/mm/shmem.c
index c42331a..391c4eb 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1655,6 +1655,11 @@ static struct inode *shmem_get_inode(struct super_block 
*sb, const struct inode
                        break;
                case S_IFREG:
                        inode->i_mapping->a_ops = &shmem_aops;
+                       /*
+                        * TODO: make tmpfs pages movable
+                        */
+                       mapping_set_gfp_mask(inode->i_mapping,
+                                            GFP_TRANSHUGE);
                        inode->i_op = &shmem_inode_operations;
                        inode->i_fop = &shmem_file_operations;
                        mpol_shared_policy_init(&info->policy,
-- 
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to