diff --git a/fs/Kconfig b/fs/Kconfig index e8800d8a73b3ac628556d212bd37523e1c93b281..2265e95cf17e01ed38b1bdd1e1e3763cb157b0ed 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -216,6 +216,7 @@ config DYNAMIC_HUGETLB depends on HUGETLB_PAGE depends on MEMCG depends on CGROUP_HUGETLB + depends on X86_64 || (ARM64 && ARM64_4K_PAGES) help Dynamic hugepage are used in memcg and can be splited into small pages automatically. The tasks in the memcg prefer to alloc dynamic hugepage. diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index e411103d2cf4d7b61d188048550252337fa24692..5fcd3586c81f1c0bf3a1921cd78a85cbd1151589 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1166,7 +1166,9 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) mpol_shared_policy_init(&p->policy, NULL); #ifdef CONFIG_DYNAMIC_HUGETLB /* Initialize hpool here in case of a quick call to destroy */ - p->hpool = get_dhugetlb_pool_from_task(current); + if (huge_page_size(sbinfo->hstate) == PMD_SIZE || + huge_page_size(sbinfo->hstate) == PUD_SIZE) + p->hpool = get_dhugetlb_pool_from_task(current); #endif return &p->vfs_inode;