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

Linux kernel 如何在linux内核中更改页面大小,linux-kernel,kernel,paging,Linux Kernel,Kernel,Paging,我想将PAGE\u SIZE从4096更改为实验。因此,我在/arch/x86/include/asm/PAGE\u types.h中更改了PAGE\u SHIFT的值。但我不能编译它 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/ke

我想将
PAGE\u SIZE
4096
更改为实验。因此,我在
/arch/x86/include/asm/PAGE\u types.h
中更改了
PAGE\u SHIFT
的值。但我不能编译它

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\u SHIFT
来直接修改
页面大小

假设您的处理器是x86,您可以使用变量系列
CONFIG\u page\u size\u XXX
修改页面大小,最大为8k,例如
CONFIG\u page\u size\u 8KB
。请注意,使用大页面将不必要地占用大量空间,因为即使是1字节的文件也会占用磁盘上的整个页面。此外,更改页面大小取决于体系结构,建议保留默认的4K大小


不过,更好的方法可能是使用更大、更灵活、更强大的页面

多谢各位。但是我找不到它。哪里是
CONFIG\u PAGE\u SIZE\u XXX
?它不仅是软件抽象,而且是MMU硬件配置。如果您的体系结构不支持这一点,您可能不会这样做。