为什么 Linux (x86) 的页面大小是 4 KB,这是如何计算的? [英] Why is the page size of Linux (x86) 4 KB, how is that calculated?

查看:21
本文介绍了为什么 Linux (x86) 的页面大小是 4 KB,这是如何计算的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux 内核在 x86 架构上的默认内存页大小是 4 KB,我想知道它是如何计算的,为什么?

The default memory page size of the Linux kernel on x86 architecture was 4 KB, I wonder how was that calculated, and why ?

推荐答案

默认页面大小由 CPU 的 MMU(内存管理单元)支持的内容决定.在 32 位保护模式下 x86 支持两种页面:

The default page size is fixed by what the MMU (memory management unit) of the CPU supports. In 32-bit protected mode x86 supports two kinds of pages:

  • 普通的,4 KiB
  • 巨大的,4 MiB

并非所有 x86 处理器都支持大页面.需要有一个具有页面大小扩展 (PSE) 功能的 CPU.这不包括奔腾之前的处理器.几乎所有当前的 x86 CPU 都实现了它.

Not all x86 processors support large pages. One needs to have a CPU with Page Size Extension (PSE) capabilities. This excludes pre-Pentium processors. Virtually all current-generation x86 CPUs implements it.

4 KiB 在其他架构中也是广泛流行的页面粒度.有人可能会争辩说,这个大小来自将 32 位虚拟地址划分为页目录/表中的两个 10 位索引,其余 12 位给出了 4 KiB 的页面大小.

4 KiB is widely popuplar page granularity in other architectures too. One could argue that this size comes from the division of a 32-bit virutal address into two 10-bit indexes in page directories/tables and the remaining 12 bits give the 4 KiB page size.

这篇关于为什么 Linux (x86) 的页面大小是 4 KB,这是如何计算的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆