首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在linux内核中更改页面大小

如何在linux内核中更改页面大小
EN

Stack Overflow用户
提问于 2019-12-13 06:32:08
回答 1查看 3.9K关注 0票数 0

为了这个实验,我想把PAGE_SIZE4096改过来。因此,我在/arch/x86/include/asm/page_types.h中更改了/arch/x86/include/asm/page_types.h的值。但我不能编译它。

代码语言:javascript
运行
复制
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,但我不知道如何改变它。我该怎么办?

EN

回答 1

Stack Overflow用户

发布于 2019-12-13 08:49:29

您不能通过设置PAGE_SIZE直接修改PAGE_SHIFT,因为它是在编译时生成的。

假设您的处理器是一个x86,您可以使用CONFIG_PAGE_SIZE_XXX (如CONFIG_PAGE_SIZE_8KB )等变量系列来修改您的页面大小,最多可达8k。请注意,使用大页面将不必要地占用大量空间,因为即使是1字节文件也会占用磁盘上的整个页面。此外,更改页面大小与体系结构有关,建议保持默认的4K大小。

一个更好的方法,可能是使用巨大的页面,更灵活和更强大。他们是在那里展出的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59317272

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档