Chinaunix首页 | 论坛 | 博客
  • 博客访问: 14323
  • 博文数量: 3
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 40
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-09 11:42
文章分类

全部博文(3)

文章存档

2023年(1)

2016年(1)

2015年(1)

我的朋友

分类: LINUX

2015-07-31 19:43:49

               HIGHMEM DISAPPEAR ON 64-bit ARCHITECTURE

 

                                               Daniel.Ni

 

What is High Memory?

====================

In short, High memory is memory address which do not have logical address.

 

           +--------------+              +--------+

Logical => | Segmentation |   Linear =>  | Paging |  => Physical

Address    |    Unit      |  Address     |  Unit  |    Address

           +--------------+              +--------+

 

In 80x86 platform of Linux, segmentation are used in a very limited way.

As a result, logical addresses coinside with linear addresses. 4GB linear

addresses are divided into two parts.

 

       * 0x00000000 - 0xbfffffff are user space

       * 0xc0000000 - 0xffffffff are kernel space

 

Why linux designers do this?

 

       * It is for privilige use. Different logical address may lead to

       different CPL through segmentation, which can provide protection.

       * It is covenient for MMU mapping. We can use the same Page Table

       leaving the kernel paging tables unchanged.

 

When linux running, running space switch between user and kernel happens

frequently. For instance, linux system call. If we use the same linear

address between user and kernel, it means that, we must let MMU do dynamic

address mapping, modifying the page tables for every space switch happens.

 

What's wrong with modifying the Page Tables?

 

Frequent Page Table modifications lead to higher average memory access times,

because they make the CPU flush the contents of the translation lookaside

buffers. Causing low CPU efficiency.

 

So there are 1GB left for kernel to use. When physical memory is less than

1GB, it could be easily directly mapped by kernel. But when physical memory

is more than 1GB, for example, 1.5GB, the left 512MB cannot be directly used

by kernel (for kernel, these physical address do not have logical address).

So, Linux designer choose another way to manage memory. The physical memory

that are less than 896MB are directly mapped. another 128MB are dynamically

allocated by kernel, using 128MB linear address could mapping the whole left

896MB ~ 4GB. The memory of 896MB-1GB are called High memory.

 

On the contrast, Low memory means less than 896MB. Low memory are used for

kernel space, while High memory can be accessed both user and kernel space.

 

On i386 systems, the boundary between low and high memory is usually set a

just under 1GB, that boundary can be changed at kernel configuration time.

It just splits the 32-bit address space between kernel and user space.

 

 

High Memory Disappear on 64-bit Architecture

=============================================

Linear memory address are divided as proportion of 3:1. In 64-bit machine,

theoretically, we could access 2^64 Bytes size of linear address space,

Actually, linear address space doesn't need so large. If memory address has

48 lines, We can access 2^48 Bytes of linear address, that would be large as

64K * 4GB. 16K * 4GB can be used for kernel space, which is large enough for

the whole physical memory directly mapped.

阅读(1344) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:韦东山mmu示例代码debug

给主人留下些什么吧!~~