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

查看:94
本文介绍了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.

在旧样式"方案中,内核进行了设置,以便每个进程的页表将0xC00000000xFFFFFFFF的虚拟地址直接映射到0x000000000x3FFFFFFF的物理地址(这些页面被标记为因此只能在环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天全站免登陆