Linux 3/1 虚拟地址拆分 [英] Linux 3/1 virtual address split

查看:14
本文介绍了Linux 3/1 虚拟地址拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在理解 highmem 需要处理超过 1GB 的 RAM 时,我遗漏了一些东西.有人能指出我哪里出错了吗?谢谢!

I am missing something when it comes to understanding the need for highmem to address more than 1GB of RAM. Could someone point out where I go wrong? Thanks!

我所知道的:

  • 进程的 1 GB 虚拟内存(高内存区域)是为内核操作保留的.用户空间可以使用剩余的 3 GB.这是 3/1 分割.

  • 1 GB of a processes' virtual memory (high memory region) is reserved for kernel operations. The user space can use the remaining 3 GB. This is the 3/1 split.

VM 的虚拟内存功能将(连续)虚拟内存页面映射到物理页面 (RAM).

The virtual memory features of the VM map the (continuous) virtual memory pages to physical pages (RAM).

我不知道的:

  • 哪些操作使用内核虚拟内存?我想像内核空间中的 kmalloc(...) 这样的东西会使用内核虚拟内存.

  • What operations use the kernel virtual memory? I suppose things like kmalloc(...) in kernel-space would use kernel virtual memory.

我认为在这个方案下可以使用 4GB 的 RAM.我不明白为什么内核 1 GB 虚拟空间是寻址物理空间时的限制因素.这就是我的理解崩溃的地方.请指教.

I would think that 4GB of RAM could be used under this scheme. I don't get why the kernel 1 GB virtual space is the limiting factor when addressing physical space. This is where my understanding breaks down. Please advise.

我一直在阅读这篇文章(http://kerneltrap.org/node/2450),这很棒.但它并没有完全解决我喜欢的问题.

I've been reading this (http://kerneltrap.org/node/2450), which is great. But it doesn't quite address my question to my liking.

推荐答案

内核虚拟空间之所以成为可用物理内存的限制因素是因为内核需要访问所有物理内存,而它访问物理内存的方式是通过内核虚拟地址.内核不使用允许直接访问物理内存位置的特殊指令 - 它必须为它想要与之对话的任何物理范围设置页表条目.

The reason that kernel virtual space is a limiting factor on useable physical memory is because the kernel needs access to all physical memory, and the way it accesses physical memory is through kernel virtual addresses. The kernel doesn't use special instructions that allow direct access to physical memory locations - it has to set up page table entries for any physical ranges that it wants to talk to.

在旧式"方案中,内核进行设置,以便每个进程的页表将虚拟地址从 0xC0000000 映射到 0xFFFFFFFF 直接到 的物理地址>0x000000000x3FFFFFFF(这些页面被标记为只能在 ring 0 - 内核模式下访问).这些是内核虚拟地址".在这种方案下,内核可以直接读写任何物理内存位置,而无需修改 MMU 来更改映射.

In the "old style" scheme, the kernel set things up so that every process's page tables mapped virtual addresses from 0xC0000000 to 0xFFFFFFFF directly to physical addresses from 0x00000000 to 0x3FFFFFFF (these pages were marked so that they were only accessible in ring 0 - kernel mode). These are the "kernel virtual addresses". Under this scheme, the kernel could directly read and write any physical memory location without having to fiddle with the MMU to change the mappings.

在 HIGHMEM 方案下,从内核虚拟地址到物理地址的映射不是固定的——物理内存的一部分被映射进内核虚拟地址空间,因为内核需要访问该内存.这允许使用更多物理内存,但代价是必须不断更改虚拟到物理映射,这是一项非常昂贵的操作.

Under the HIGHMEM scheme, the mappings from kernel virtual addresses to physical addresses aren't fixed - parts of physical memory are mapped in and out of the kernel virtual address space as the kernel needs access to that memory. This allows more physical memory to be used, but at the cost of having to constantly change the virtual-to-physical mappings, which is quite an expensive operation.

这篇关于Linux 3/1 虚拟地址拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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