All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "shy828301@gmail.com" <shy828301@gmail.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: kernel 5.10.x Reserves much more RAM than 5.11.0, 8 MB vs 20 MB
Date: Thu, 28 Oct 2021 09:55:47 +0000	[thread overview]
Message-ID: <6e986b84ae325fc9e676a4a2026358573bbf7e24.camel@infinera.com> (raw)
In-Reply-To: <CAHbLzkpfd4SYESWhoYYpfrzveJbErYCJQuFhqjcqMZ59+gQJcw@mail.gmail.com>

On Wed, 2021-10-27 at 10:12 -0700, Yang Shi wrote:
> On Wed, Oct 27, 2021 at 5:48 AM Joakim Tjernlund
> <Joakim.Tjernlund@infinera.com> wrote:
> > 
> > Using a fairly minimal kernel I get a big difference in Reserved memory, using:
> >     qemu-system-aarch64 -machine virt -kernel arch/arm64/boot/Image -cpu cortex-a53  -nographic -m 32M
> > 
> > I get this:
> > Linux version 5.11.0
> > Memory: 24052K/32768K available (3520K kernel code, 684K rwdata, 548K rodata, 320K init, 245K bss, 8716K reserved, 0K cma-reserved)
> > 
> > Versus:
> > 
> > Linux version 5.10.75
> > Memory: 11836K/32768K available (3518K kernel code, 684K rwdata, 540K rodata, 320K init, 244K bss, 20932K reserved, 0K cma-reserved)
> > 
> > Reserving 20 MB RAM on a 32 MB is way too much, even 8Mb is a bit much for us.
> 
> This might be caused by the new lockless printk buffer patch
> introduced in 5.10. We noticed this spike on 5.10 kernel too. It may
> have much more memory reserved for meta data and the total amount may
> be as much as 3x of log_buf_len. The amount varies on different
> platforms with different configs. I didn't dig too much into the
> details to figure out how it gets the number.
> 
> You could try to adjust CONFIG_LOG_BUF_SHIFT or set log_buf_len from
> kernel commandline to limit the printk buffer size.

I did try this by changing LOG_BUF_SHIFT but the resulting change was just minor.

To get some info about meminfo/zoneinfo I booted with an inird FS and got this:
  Memory: 9576K/32768K available (3518K kernel code, 460K rwdata, 540K rodata, 320K init, 180K bss, 23192K reserved, 0K cma-reserved)
The initrd only added some 3 MB's
Here are meminfo/zoneinfo, not sure if they are useful though.

 cat /proc/meminfo 
MemTotal:          12416 kB
MemFree:            4644 kB
MemAvailable:       4064 kB
Buffers:               0 kB
Cached:             4788 kB
SwapCached:            0 kB
Active:             2500 kB
Inactive:           2524 kB
Active(anon):       2500 kB
Inactive(anon):     2524 kB
Active(file):          0 kB
Inactive(file):        0 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:           248 kB
Mapped:             1844 kB
Shmem:              4788 kB
KReclaimable:          0 kB
Slab:               1712 kB
SReclaimable:          0 kB
SUnreclaim:         1712 kB
KernelStack:         384 kB
PageTables:           80 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:        6208 kB
Committed_AS:       5636 kB
VmallocTotal:   262930368 kB
VmallocUsed:         324 kB
VmallocChunk:          0 kB
Percpu:               76 kB
HardwareCorrupted:     0 kB

 cat /proc/zoneinfo 
Node 0, zone   Normal
  per-node stats
      nr_inactive_anon 631
      nr_active_anon 625
      nr_inactive_file 0
      nr_active_file 0
      nr_unevictable 0
      nr_slab_reclaimable 0
      nr_slab_unreclaimable 429
      nr_isolated_anon 0
      nr_isolated_file 0
      workingset_nodes 0
      workingset_refault_anon 0
      workingset_refault_file 0
      workingset_activate_anon 0
      workingset_activate_file 0
      workingset_restore_anon 0
      workingset_restore_file 0
      workingset_nodereclaim 0
      nr_anon_pages 62
      nr_mapped    461
      nr_file_pages 1197
      nr_dirty     0
      nr_writeback 0
      nr_writeback_temp 0
      nr_shmem     1197
      nr_shmem_hugepages 0
      nr_shmem_pmdmapped 0
      nr_file_hugepages 0
      nr_file_pmdmapped 0
      nr_anon_transparent_hugepages 0
      nr_vmscan_write 0
      nr_vmscan_immediate_reclaim 0
      nr_dirtied   0
      nr_written   0
      nr_kernel_misc_reclaimable 0
      nr_foll_pin_acquired 0
      nr_foll_pin_released 0
      nr_kernel_stack 384
  pages free     1162
        min      97
        low      121
        high     145
        spanned  8192
        present  8192
        managed  3104
        protection: (0, 0)
      nr_free_pages 1162
      nr_zone_inactive_anon 631
      nr_zone_active_anon 625
      nr_zone_inactive_file 0
      nr_zone_active_file 0
      nr_zone_unevictable 0
      nr_zone_write_pending 0
      nr_mlock     0
      nr_page_table_pages 19
      nr_bounce    0
      nr_free_cma  0
  pagesets
    cpu: 0
              count: 0
              high:  0
              batch: 1
  vm stats threshold: 2
  node_unreclaimable:  0
  start_pfn:           262144
Node 0, zone  Movable
  pages free     0
        min      0
        low      0
        high     0
        spanned  0
        present  0
        managed  0
        protection: (0, 0)



  reply	other threads:[~2021-10-28  9:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 12:48 kernel 5.10.x Reserves much more RAM than 5.11.0, 8 MB vs 20 MB Joakim Tjernlund
2021-10-27 12:57 ` David Hildenbrand
2021-10-27 13:20   ` Joakim Tjernlund
2021-10-27 13:35 ` Matthew Wilcox
2021-10-27 13:41   ` Joakim Tjernlund
2021-10-27 14:17     ` David Hildenbrand
2021-10-27 14:50       ` Joakim Tjernlund
2021-10-27 17:12 ` Yang Shi
2021-10-28  9:55   ` Joakim Tjernlund [this message]
2021-10-28 21:52     ` Yang Shi

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=6e986b84ae325fc9e676a4a2026358573bbf7e24.camel@infinera.com \
    --to=joakim.tjernlund@infinera.com \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.