6

From proc manual:

/proc/kcore

This file represents the physical memory of the system and is stored in the ELF core file format. With this pseudo-file, and an unstripped kernel (/usr/src/linux/vmlinux) binary, GDB can be used to examine the current state of any kernel data structures.

The total length of the file is the size of physical memory (RAM) plus 4KB.

I can see the size of /proc/kcore is the size of physical memory (RAM) plus 4KB.

But on my SuSE Linux:

# ls -lt  --block-size=M /proc/kcore
-r-------- 1 root root 134217727M Nov 15 21:09 /proc/kcore
# cat /proc/meminfo

MemTotal: 792680 kB MemFree: 79960 kB MemAvailable: 351664 kB Buffers: 40 kB Cached: 246588 kB SwapCached: 212 kB Active: 282992 kB Inactive: 292896 kB Active(anon): 122652 kB Inactive(anon): 214164 kB Active(file): 160340 kB Inactive(file): 78732 kB Unevictable: 100 kB Mlocked: 100 kB SwapTotal: 1532924 kB SwapFree: 1531088 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 329148 kB Mapped: 71888 kB Shmem: 7556 kB Slab: 63088 kB SReclaimable: 46300 kB SUnreclaim: 16788 kB KernelStack: 1888 kB PageTables: 0 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 1929264 kB Committed_AS: 1451492 kB VmallocTotal: 34359738367 kB VmallocUsed: 7580 kB VmallocChunk: 34359726080 kB HardwareCorrupted: 0 kB DirectMap4k: 867568 kB DirectMap2M: 0 kB

Why is the size of /proc/kcore file so bigger than the physical memory size?

Nan Xiao
  • 1,407
  • 1
    how much swap do you have? – cas Nov 16 '15 at 02:40
  • @cas: Update the output of "cat /proc/meminfo". – Nan Xiao Nov 16 '15 at 02:44
  • 1
    see http://superuser.com/questions/168114/how-much-memory-can-a-64bit-machine-address-at-a-time - 128TB is the maximum virtual address space on 64-bit linux. – cas Nov 16 '15 at 03:06
  • 1
    @cas: But from proc manual, it should be "the total length of the file is the size of physical memory (RAM) plus 4KB". How to explain it? – Nan Xiao Nov 16 '15 at 05:07
  • 3
    That's a mystery. If i didn't know better, if I didn't know that it could never possibly be the case because devs always keep their docs up to date and accurate, I might suspect that the documentation is wrong. – cas Nov 16 '15 at 06:52
  • @cas: Yes, you are right. From this post, the 128T is the absolute limit of what 64-bit systems can allocate. – Nan Xiao Nov 17 '15 at 06:35

1 Answers1

4

kcore is the virtual allocation of your RAM for the kernel. On 64 bit systems that size can be an absolute limit of 128T since that is the most the system can allocate.

cesar
  • 577