linux-kernel - 如何在 Linux 内核中更改 PAGESIZE
问题描述
我想PAGE_SIZE
从4096
实验中改变。所以我改变了PAGE_SHIFT
in的值/arch/x86/include/asm/page_types.h
。但我无法编译它。
In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from include/linux/cache.h:4,
from include/linux/time.h:4,
from arch/x86/kernel/vsyscall_64.c:23:
arch/x86/kernel/vsyscall_64.c: function ‘map_vsyscall’ 内:
include/linux/compiler.h:437:20: eroor: call to ‘compiletime_assert_390’ declared with attribute error: BUILD_BUG_ON failed: (unsigned long)__fix_to_virt(VVAR_PAGE) != (unsigned long)VVAR_ADDRESS
prefix ## suffix(); \
^
include/linux/compiler.h:442:2: note: in expansion of macro ‘__compiletime_assert’
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler.h:454:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE)
^
include/linux/bug.h:53:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:77:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
arch/x86/kernel/vsyscall_64.c:389:2: note: in expansion of macro ‘BUILD_BUG_ON ’
BUILD_BUG_ON((unsigned long)__fix_to_virt(VVAR_PAGE) !=
^
make[2]: * [arch/x86/kernel/vsyscall_64.o] eroor 1
make[1]: * [arch/x86/kernel] error 2
make: *** [arch/x86] error 2
可能是由于 VVAR_PAGE,但我不知道如何更改它。我应该怎么办?
解决方案
您不能直接修改PAGE_SIZE
by 设置PAGE_SHIFT
,因为它是在编译时生成的。
假设您的处理器是 x86,您可以使用CONFIG_PAGE_SIZE_XXX
诸如CONFIG_PAGE_SIZE_8KB
. 请注意,使用大页面会不必要地占用大量空间,因为即使是 1 字节文件也会占用磁盘上的一整页。此外,更改页面大小取决于体系结构,建议保留默认的 4K 大小。
不过,更好的方法可能是使用大页面,更灵活,更强大。他们在那里展示
推荐阅读
- java - Struts Action 类中的不可序列化属性
- ubuntu - 如何将 Windows 10 WSL 2 Linux 发行版移动到另一个位置
- css - 你如何在其他图像的边界内填充图像?
- php - 如何在php中将动态行数据表单插入mysql
- javascript - 如何在JS中的数组中加入连续的int元素
- javascript - 根据单选按钮选中状态保持 div 的活动状态
- javascript - 脚本在 div 外加载
- angular - 如何在 angular8 项目中打印 HTML 内容?
- video-streaming - 防止在流式传输期间下载视频
- python - 如何更改 Flask 中的路线?