Unverified Commit 342eb2bd authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!1871 Improve hugetlb for cloud use case when kernelcore=mirror is set

Merge Pull Request from: @x56Jason 
 
# Description

When kernelcore=mirror is set, all kernel memory are allocated from mirrored region.
This is not desirable in some cloud use case where CSP wants to allocate large hugepages
from non-mirrored region at early boot time, and put guest memory in these hugetlb pages.

Meanwhile, if we put hugepages in non-mirrored region, there is another issue when
virtual machine has device passthrough. This is because device passthrough requires
to pin all guest memory. However, boot time allocated non-mirrored hugetlb pages memory
will be put into ZONE_MOVABLE, and ZONE_MOVABLE hugetlb memory can't be pinned.

This PR is to implement 2 functionalities:
- Add a kernel command line option "hugepage_no_mirror" to specify allocating boot-time hugetlb pages from non-mirrored memory.
- Move boot-time hugetlb pages from ZONE_MOVABLE to ZONE_NORMAL if "hugepage_no_mirror" is set, so that they can be pinned.

# Test

Using kernel command line "intel_iommu=on iommu=pt kernelcore=mirror default_hugepagesz=1G hugepagesz=1G hugepage_no_mirror hugepages=16" and device passthrough to launch guest VM:
- with this patch series, boot time hugepage can be allocated from non-mirrored memory and guest VM can be launched successfully
- Without the patch that moves non-mirrored memory to ZONE_NORMAL, guest VM fails to launch with error "cann't allocate memory"
- Without the whole patch series, boot time hugepages will be allocated in mirrored memory, and if mirrored memory is not so much, the allocation of hugepages will occupy large amount of mirrored memory, and the system triggers OOM.

# Known Issue
N/A

# Default Kernel Config Change
N/A
 
 
Link:https://gitee.com/openeuler/kernel/pulls/1871

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarWei Li <liwei391@huawei.com>
parents 546f8ab7 520e5032
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment