Commit d0585a6f authored by Wang Wensheng's avatar Wang Wensheng Committed by Zheng Zengkai
Browse files

mm/hugetlb: allocate huge page and setup page table

ascend inclusion
category: Feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4NDAW


CVE: NA

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

Introduce function hugetlb_alloc_hugepage that alloc hugepages from
static hugepages first. When the static hugepage is used up, it attempts
to apply for hugepages from buddy system. Two additional modes are
supported: static hugepages only and buddy hugepages only.

When the driver gets huge pages by alloc_huge_page_node, it attempts
to apply for migrate hugepages after the reserved memory hugepages
are used up. We expect that the migrated hugepages that are applied
for can be charged in memcg to limit the memory usage. So we enable
charge migrate hugepages, and default enable it.

Add hugetlb_insert_hugepage_pte[_by_pa] to insert hugepages into page
table. The by_pa version performs like remap_pfn_range() that make the
pte special and can be used for reserved physical memory.

Signed-off-by: default avatarWang Wensheng <wangwensheng4@huawei.com>
Signed-off-by: default avatarZhou Guanghui <zhouguanghui1@huawei.com>
Signed-off-by: default avatarZhang Jian <zhangjian210@huawei.com>
Reviewed-by: default avatarKefeng <Wang&lt;wangkefeng.wang@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 9f4d5f42
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment