Determining the reason for reserved RAM

Mikhail Krylov sqarert at gmail.com
Sun Jan 8 04:49:52 EST 2023


I think I (partly) found the answer myself.

The biggest part that is in 0x35b4a000-0x36b55fff area is memory map.

Its size corresponds really well with sizeof(struct page)*number of
pages (it should be exactly 15M instead of 16).

And looking on it with gdb I was able to see 40-byte patterns that
closely resemble array of these structs. The only problem I had is that
kernel's symbol mem_map doesn't point to this structure, it is set to 0,
but I guess it's probably not used anymore.

On Tue, Jan 03, 2023 at 09:51:08PM +0300, Mikhail Krylov wrote:
> Hello,
> 
> I was doing some research figuring out what kernel reserves memory for,
> and found myself in a sort of dead-end.
> 
> I found out that /proc/kpageflags bit 32 is set for reserved physical
> pages in include/linux/kernel-page-flags.c, wrote a simple decoder of
> that file, and on an old 32-bit x86 machine (it's the simplest there,
> since it has less memory and fewest amount of memory holes) those are
> reserved:
> 
> 0x00000000-0x0000ffff - I assume those addresses are used for interrupt
> vectors and whatnot
> 0x0009b000-0x000fffff - Video RAM/ROM for VGA/EGA/CGA and whatnot
> 0x01c00000-0x01c1ffff - no idea, it also has KPF_UNCACHED flag as well
> 0x1d000000-0x1dd73fff - Kernel code, rodata, rwdata, bss
> 0x35b4a000-0x36b55fff - no idea.
> 
> I also found out that region #5 is getting bigger or smaller depending
> on the machine's memory size. On this 1.5G machine it's a bit more than
> 16M. On a 32G machine it's more than 500M size, feels a bit wasteful
> IMO. So my question is, could you tell me where to look for what those
> regions are and why those regions exist?  I've checked /proc/iomem and
> it doesn't say it is reserved or anything, just "System RAM".
> 
> Thanks in advance, Mikhail.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20230108/887c5bb6/attachment.sig>


More information about the Kernelnewbies mailing list