On Tue, Oct 13, 2020 at 6:12 AM Cong Wang <xiyou.wangcong@xxxxxxxxx> wrote: > > On Mon, Oct 12, 2020 at 2:53 AM Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote: > > We are not complaining about TCP using too much memory, but how do > > we know that TCP uses a lot of memory. When I firstly face this problem, > > I do not know who uses the 25GB memory and it is not shown in the /proc/meminfo. > > If we can know the amount memory of the socket buffer via /proc/meminfo, we > > may not need to spend a lot of time troubleshooting this problem. Not everyone > > knows that a lot of memory may be used here. But I believe many people > > should know /proc/meminfo to confirm memory users. > > Well, I'd bet networking people know `ss -m` better than /proc/meminfo, I agree with you. But if someone(not networking people) faces the same problem. He may suspect that there is a memory leak or think that a certain driver allocates memory but has no statistics. He only saw the memory disappeared via /proc/meminfo. > generally speaking. > > The practice here is that if you want some networking-specific counters, > add it to where networking people know better, that is, `ss -m` or /proc/net/... > > Or maybe the problem you described is not specific to networking at all, > there must be some other places where pages are allocated but not charged. Yeah, it is not charged. The allocation path is as follows. This allocation consumes 25GB memory on our server. And it belongs to the network core. Thanks. __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 > If so, adding a general mm counter in /proc/meminfo makes sense, but > it won't be specific to networking. > > Thanks. -- Yours, Muchun