Re: Memory: 880608K/983040K .... 36896K reserved ?

2020-07-01 Thread Michael Ellerman
Joakim Tjernlund  writes:
> I cannot figure out how the xxxK reserved item works in:
>  Memory: 880608K/983040K available (9532K kernel code, 1104K rwdata, 3348K 
> rodata, 1088K init, 1201K bss, 36896K reserved ...

It's calculated as:

(physpages - totalram_pages() - totalcma_pages)

The naming is a bit historical I guess.

But roughly physpages is the total number of pages of RAM we think exist
in the system.

totalram_pages() is the total number of pages that have been freed to
the buddy allocator.

totalcma_pages is pages used by CMA which is probably 0 for you.

So the amount "reserved" is the memory that hasn't been freed to the
buddy allocator by memblock.

You should be able to see it in debugfs:

# cat /sys/kernel/debug/memblock/reserved 
   0: 0x..0x02b40e57
   1: 0x02b41000..0x02b413ff
   2: 0x02b5..0x02ba
   3: 0x0a91..0x0e93
   4: 0x0fe8..0x0fe9
   5: 0x0feac000..0x0ffebfff
   6: 0x0ffed400..0x0ffed7ff
   7: 0x0ffeda80..0x0ffeebff
   8: 0x0ffeee80..0x0ffe
   9: 0x0fff0280..0x0fff13ff
   ...

> Is there a way to tune(lower it) this memory?

Some or most of those reserved regions will be things your firmware told
you to reserve, so you need to work out what each region is. They might
be firmware things, or even holes in RAM, you need to dig deeper to find
out what is what.

cheers


Memory: 880608K/983040K .... 36896K reserved ?

2020-07-01 Thread Joakim Tjernlund
I cannot figure out how the xxxK reserved item works in:
 Memory: 880608K/983040K available (9532K kernel code, 1104K rwdata, 3348K 
rodata, 1088K init, 1201K bss, 36896K reserved ...

Is there a way to tune(lower it) this memory?

 Jocke