add memmap interface to reserved memory 特性同步:openEuler-1.0=LTS 到OLK-5.10。
经分析,该特性仍有使用,需同步。考虑到预留内存的兼容性,对原始补丁需进行适当重构。
Hi pengliustd, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers: @成坚 (CHENG Jian) , @Qiuuuuu , @zhengzengkai , @gogooo , @pi3orama , @Xie XiuQi , @YangYingliang
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
使用memblock_alloc(size, 0) 代替alloc_bootmem(size)
commit 2a5bda5a624d6471d25e953b9adba5182ab1b51f
Author: Mike Rapoport rppt@linux.vnet.ibm.com
Date: Tue Oct 30 15:09:09 2018 -0700
memblock: replace alloc_bootmem with memblock_alloc
The alloc_bootmem(size) is a shortcut for allocation of SMP_CACHE_BYTES
aligned memory. When the align parameter of memblock_alloc() is 0, the
alignment is implicitly set to SMP_CACHE_BYTES and thus alloc_bootmem(size)
and memblock_alloc(size, 0) are equivalent.
The conversion is done using the following semantic patch:
@@
expression size;
@@
- alloc_bootmem(size)
+ memblock_alloc(size, 0)
验证:
1.环境:
qemu 虚拟机,arm64,cmdline: memblock=debug memmap=1m$0x50000000
2.期望结果:
dmesg可以看到0x50000000处预留了1M内存。
3.实际结果:
左侧未添加memmap=1m$0x50000000, 右侧添加了memmap=1m$0x50000000,表明添加memmap=1m$0x50000000后预留内存成功。
符合预期
增加功能
限制内核使用的内存区域
用法: memmap=exactmap memmap=1G@1G
含义:限制内核使用第2G的内存
下图中正好可以看到内核内存限制在第2G,符合预期。
登录 后才可以发表评论