Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

Muchun Song
2020-10-11T04:43:25Z

On Sun, Oct 11, 2020 at 12:37 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> Hi,
>
> On 10/10/20 3:38 AM, Muchun Song wrote:
> > The amount of memory allocated to sockets buffer can become significant.
> > However, we do not display the amount of memory consumed by sockets
> > buffer. In this case, knowing where the memory is consumed by the kernel
> > is very difficult. On our server with 500GB RAM, sometimes we can see
> > 25GB disappear through /proc/meminfo. After our analysis, we found the
> > following memory allocation path which consumes the memory with page_owner
> > enabled.
> >
> > 849698 times:
> > Page allocated via order 3, mask 0x4052c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP)
> > __alloc_pages_nodemask+0x11d/0x290
> > skb_page_frag_refill+0x68/0xf0
> > sk_page_frag_refill+0x19/0x70
> > tcp_sendmsg_locked+0x2f4/0xd10
> > tcp_sendmsg+0x29/0xa0
> > sock_sendmsg+0x30/0x40
> > sock_write_iter+0x8f/0x100
> > __vfs_write+0x10b/0x190
> > vfs_write+0xb0/0x190
> > ksys_write+0x5a/0xd0
> > do_syscall_64+0x5d/0x110
> > entry_SYSCALL_64_after_hwframe+0x44/0xa9
> >
> > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > ---
> > drivers/base/node.c | 2 ++
> > drivers/net/virtio_net.c | 3 +--
> > fs/proc/meminfo.c | 1 +
> > include/linux/mmzone.h | 1 +
> > include/linux/skbuff.h | 43 ++++++++++++++++++++++++++++++++++++++--
> > kernel/exit.c | 3 +--
> > mm/page_alloc.c | 7 +++++--
> > mm/vmstat.c | 1 +
> > net/core/sock.c | 8 ++++----
> > net/ipv4/tcp.c | 3 +--
> > net/xfrm/xfrm_state.c | 3 +--
> > 11 files changed, 59 insertions(+), 16 deletions(-)
>
> Thanks for finding that.
>
> Please update Documentation/filesystems/proc.rst "meminfo" section also.

Will do. Thanks for your suggestions.

>
> --
> ~Randy
>

--
Yours,
Muchun