提交 3c2e6fb6 编写于 作者: L Liu Shixin

mm/dynamic_hugetlb: support dynamic hugetlb on arm64

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6XOIE
CVE: NA

--------------------------------

To support dynamic hugetlb on arm64, we need to do two more things. The
first one is to fix kabi broken in mem_cgroup, we use kabi_reserve_5 to
fix it in previous patch. The second one is to check cont-bit hugetlb
since this feature only support for PMD-size and PUD-size hugepage.

This feature only support for 4KB pagesize, not support for 16KB and 64KB.
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
上级 d877da6b
......@@ -262,7 +262,7 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON
config DYNAMIC_HUGETLB
bool "Dynamic HugeTLB"
depends on X86_64
depends on X86_64 || (ARM64 && ARM64_4K_PAGES)
depends on HUGETLBFS
depends on MEMCG && CGROUP_HUGETLB
help
......
......@@ -1202,7 +1202,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb)
*/
mpol_shared_policy_init(&p->policy, NULL);
/* Initialize hpool here in case of a quick call to destroy */
link_hpool(p);
link_hpool(p, sbinfo->hstate);
return &p->vfs_inode;
}
......
......@@ -97,7 +97,7 @@ bool free_page_to_dhugetlb_pool(struct page *page);
void free_page_list_to_dhugetlb_pool(struct list_head *list);
int task_has_mem_in_hpool(struct task_struct *tsk);
void link_hpool(struct hugetlbfs_inode_info *p);
void link_hpool(struct hugetlbfs_inode_info *p, struct hstate *h);
void unlink_hpool(struct hugetlbfs_inode_info *p);
bool file_has_mem_in_hpool(struct hugetlbfs_inode_info *p);
int dhugetlb_acct_memory(struct hstate *h, long delta, struct hugetlbfs_inode_info *p);
......@@ -147,7 +147,7 @@ static inline int task_has_mem_in_hpool(struct task_struct *tsk)
}
#ifdef CONFIG_HUGETLBFS
static inline void link_hpool(struct hugetlbfs_inode_info *p)
static inline void link_hpool(struct hugetlbfs_inode_info *p, struct hstate *h)
{
}
static inline void unlink_hpool(struct hugetlbfs_inode_info *p)
......
......@@ -5,6 +5,7 @@
#include <linux/rmap.h>
#include <linux/migrate.h>
#include <linux/memblock.h>
#include <linux/memory_hotplug.h>
#include <linux/dynamic_hugetlb.h>
......@@ -618,13 +619,19 @@ void free_page_list_to_dhugetlb_pool(struct list_head *list)
}
}
void link_hpool(struct hugetlbfs_inode_info *p)
void link_hpool(struct hugetlbfs_inode_info *p, struct hstate *h)
{
unsigned long size;
if (!dhugetlb_enabled || !p)
return;
p->hpool = find_hpool_by_task(current);
if (!get_hpool_unless_zero(p->hpool))
size = huge_page_size(h);
if (size == PMD_SIZE || size == PUD_SIZE) {
p->hpool = find_hpool_by_task(current);
if (!get_hpool_unless_zero(p->hpool))
p->hpool = NULL;
} else
p->hpool = NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册