Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3279894pxu; Sun, 11 Oct 2020 04:06:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMbHD6g4wIsqa6EXx5SWaTU53slTuzDGvEJ3dSEpbt9HmPZjFm3lEPkb2UZ4jS4fnAfCSv X-Received: by 2002:aa7:c659:: with SMTP id z25mr8542058edr.219.1602414371910; Sun, 11 Oct 2020 04:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602414371; cv=none; d=google.com; s=arc-20160816; b=qbxq+tPkelAH0/seI7bkrZziTbb9sL4QHTA6XewMUeLLvzRq4cOjq3ACKCXqque6gc evPxFC+dMezbRp3pab+FRB2OKU9DsXFKNYzRCYkm2yYmYZKURsLuDPIANXTJ/nU/rdZV VYTe7rcb5LQUkAyJHEFJ3pAG3BklleI6TnG9W+fjr85QhBxF6Vy62OE3S53rnDbmjF0S sSdgkm/Fwhzz1D2n+/NLSdWuNpdByGRsrayA97cHbP5rmrRSE7XVMNpiYsStghmqlGDm u8GtoN+iMxM3M2O6WN2KILHcNjkkBGlunZhTcWMCuS/TGMjOdbVqMCoUVQg3mp8oFZ0M 0S6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=MW24HhFwFfGIeQJGLuezuzELB0g5N7HkPqr7uAX0N+s=; b=VObl8ld/F1szlG+A6UKUhEqpZsZsgQvn+8EpvoyIassCK31l/m9oPr96fJVCTv1W2I X7VW6NzcsQV1vxpPlFghI/15dY7LpGR9TaktowuHgpxvFl4Gi0Vlv8R9dPSFe/FbJdAD NiiSPE/kLMIZ6u32Ja3vYThexd+qkSJvO0qf/zR9h4X1jaw0Hx1Ck3uu/nHbsbvWEVFk OEaqw2R3d5pEyIr0TWPkv3/5R55uGuGgCzE9vEBAvJU/ejb5f7v/hc4LVCeYM8lzwtKz 5KJVL4V+sfDeJFOA0XJxk+Vnue7NhTWEDdOulVYcQpocGVlVBent+HSqdL20yLEU1GhK daKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=oScIWqUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si10258336edj.155.2020.10.11.04.05.25; Sun, 11 Oct 2020 04:06:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=oScIWqUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731552AbgJJWUS (ORCPT + 99 others); Sat, 10 Oct 2020 18:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729470AbgJJSo1 (ORCPT ); Sat, 10 Oct 2020 14:44:27 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72855C05BD39; Sat, 10 Oct 2020 09:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=MW24HhFwFfGIeQJGLuezuzELB0g5N7HkPqr7uAX0N+s=; b=oScIWqUOiH3J9pqSo9SHSZaKgg G9dV+RYanl2AxUqG2llr4HvArk+ueT9cGvrgm3Qkh1pbG+IkGDLOZQCggUtAarBWTjiPYDDi3cCgr mPJs8/BlMEL1ucx0YiembjuXBi3e3ZHa4OKjNzTsc2k28FSD9USstIqnzNE+oE3FZbvKTMcAyAVN4 bSTZwsZ1o1i8ct8E6eujqe2U0GVTJewEeNhJK3TZDoTObSFTsSah9TUMKEPXLWq2xOQ3eyWYkpXJq cFhjzoIoFWn+afqvTSG9cgPUg3q4nZ2r9FrZDQyE2T8sVEl/oUAqes3hG9Lb8NaqyG5zZ2ZX5KyJw YPQtQWCQ==; Received: from [2601:1c0:6280:3f0::507c] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kRHrD-00024R-2j; Sat, 10 Oct 2020 16:36:31 +0000 Subject: Re: [PATCH] mm: proc: add Sock to /proc/meminfo To: Muchun Song , gregkh@linuxfoundation.org, rafael@kernel.org, mst@redhat.com, jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org, adobriyan@gmail.com, akpm@linux-foundation.org, edumazet@google.com, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, steffen.klassert@secunet.com, herbert@gondor.apana.org.au, shakeelb@google.com, will@kernel.org, mhocko@suse.com, guro@fb.com, neilb@suse.de, rppt@kernel.org, samitolvanen@google.com, kirill.shutemov@linux.intel.com, feng.tang@intel.com, pabeni@redhat.com, willemb@google.com, fw@strlen.de, gustavoars@kernel.org, pablo@netfilter.org, decui@microsoft.com, jakub@cloudflare.com, peterz@infradead.org, christian.brauner@ubuntu.com, ebiederm@xmission.com, tglx@linutronix.de, dave@stgolabs.net, walken@google.com, jannh@google.com, chenqiwu@xiaomi.com, christophe.leroy@c-s.fr, minchan@kernel.org, kafai@fb.com, ast@kernel.org, daniel@iogearbox.net, linmiaohe@huawei.com, keescook@chromium.org Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <20201010103854.66746-1-songmuchun@bytedance.com> From: Randy Dunlap Message-ID: Date: Sat, 10 Oct 2020 09:36:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201010103854.66746-1-songmuchun@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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. -- ~Randy