Kernel Newbies archive mirror
 help / color / mirror / Atom feed
From: Mikhail Krylov <sqarert@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: Re: Determining the reason for reserved RAM
Date: Sun, 8 Jan 2023 12:49:52 +0300	[thread overview]
Message-ID: <Y7qRwAoiIGjwwtVB@sqrt.uni.cx> (raw)
In-Reply-To: <Y7R5HAvVyoQr05NC@sqrt.uni.cx>


[-- Attachment #1.1: Type: text/plain, Size: 1826 bytes --]

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.



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2023-01-08  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 18:51 Determining the reason for reserved RAM Mikhail Krylov
2023-01-08  9:49 ` Mikhail Krylov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y7qRwAoiIGjwwtVB@sqrt.uni.cx \
    --to=sqarert@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).