Por que o tamanho de / proc / kcore é menor que a RAM? [fechadas]

0

Eu estava me perguntando por que isso acontece. Todos os links (descobri) relativos ao tamanho do arquivo indicam que o tamanho é aproximadamente o mesmo que o tamanho da RAM física ou o tamanho do processador pode endereçar. Estou em 32bit.

Por vezes, utilizo kcore quando necessito de string da RAM para procurar texto eliminado.

/proc/kcore: 1.1GB

RAM: 2.6 GB

~ $ ll /proc/kcore
-r-------- 1 root root 1065349120 2011-12-05 09:42 /proc/kcore
~ $ sudo dd if=/proc/kcore of=/dev/null bs=1024
1040380+0 records in
1040380+0 records out
1065349120 bytes (1.1 GB) copied, 2.26191 s, 471 MB/s

~ $ free -m
             total       used       free     shared    buffers     cached
Mem:          2509       1742        766          0        132       1118
-/+ buffers/cache:        492       2016
Swap:         1051          0       1051

~ $ grep ^Mem /proc/meminfo
MemTotal:        2569640 kB
MemFree:          791548 kB

~ $ dmesg | grep Memory
[    0.000000] Memory: 2554056k/2612412k available (4940k kernel code, 57908k reserved, 2333k data, 688k init, 1703108k highmem)

~ $ sudo lspci -v -s 00:02.0
00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Integrated Graphics Controller (rev 04) (prog-if 00 [VGA controller])
    Subsystem: Intel Corporation Device 4556
    Flags: bus master, fast devsel, latency 0, IRQ 16
    Memory at ffa00000 (32-bit, non-prefetchable) [size=512K]
    I/O ports at ec00 [size=8]
    Memory at c0000000 (32-bit, prefetchable) [size=256M]
    Memory at ffa80000 (32-bit, non-prefetchable) [size=256K]
    Expansion ROM at <unassigned> [disabled]
    Capabilities: [d0] Power Management version 2
    Kernel driver in use: i915
    Kernel modules: i915

A saída completa de dmesg e lspci no pastebin do Ubuntu .

Alguém sabe por que é tão

ou - alguém está vendo o mesmo comportamento (tamanho (kcore) < size (RAM))?

    
por arrange 05.12.2011 / 09:58

1 resposta

2

Estou vendo o mesmo comportamento no meu sistema:

free -m
             total       used       free     shared    buffers     cached
Mem:          2011       1877        133          0        128        685
-/+ buffers/cache:       1063        947
Swap:         2099          1       2098

ll /proc/kcore 
-r-------- 1 root root 1016M 2011-12-06 01:09 /proc/kcore

Ok, eu não tenho tanta certeza sobre isso, mas isso pode estar relacionado com o problema HIGHMEM / LOWMEM em sistemas de 32 bits.

Veja isso:

dmesg | grep MEM
[    0.000000] 1158MB HIGHMEM available.
[    0.000000] 887MB LOWMEM available.

via linux-mm

Why highmem

Currently the 32 bit x86 architecture is the most popular type of computer. In this architecture, traditionally the Linux kernel has split the 4GB of virtual memory address space into 3GB for user programs and 1GB for the kernel.

....

Coping with highmem

However, many people insist on using more than 1GB of physical memory on such a 32 bit system. This makes it necessary for the Linux kernel to jump through some interesting hoops...

Basically the system uses the following tactics:

Memory above the physical address of 896MB are temporarily mapped into kernel virtual memory whenever the kernel needs to access that memory.

Data which the kernel frequently needs to access is allocated in the lower 896MB of memory (ZONE_NORMAL) and can be immediately accessed by the kernel (see Temporary mapping).

...

Então, acho que só vemos espaço de memória reservada do kernel com / proc / kcore. A propósito, estou usando uma versão de 32 bits do Ubuntu também.

    
por heartsmagic 06.12.2011 / 00:41