Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3513128pxu; Sun, 11 Oct 2020 12:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAXFVo9FZw/O2ADOxmowhPqEAP1UpvzrQ0nbI29hQ/rlVhRJD59qIQc1bwCDH0iIGzmfrC X-Received: by 2002:a05:6402:31bc:: with SMTP id dj28mr10709222edb.10.1602444950175; Sun, 11 Oct 2020 12:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602444950; cv=none; d=google.com; s=arc-20160816; b=ViyovqdVMb+pXOK0KcCXDqIPMawYUW4UoSZF64ax0icZjLUAVFK7g59Gz3/UuvavhC u5L4Ftm2KdOAvhUmTyji9NsUD5O7YuW6bfy8+krS3eE84PLafAYMf5go3SqJ0IkjC4jk QAIGJQZXi9aIDZ1RxW65YSK6qJfkGZPjLs++kV/cedS4IsdA9a+GzabOxIO82PzohAp6 AX69rdocenz3cXogSbkACshnoHJjmWlkcModZ88d88djXdZr8XArjF9SKbPxwPxk/KlP dA0iwPut2rCL82xXxNrTw33BKoc2h+lkWDYixZofUduNuK7i2ZSwpQlmipg5UXp6brXI pH/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TW9KMm6OrgwSQSQ2ZasuwFiv2daX2uTGOG3qcoUMv5w=; b=HmjVs2Dx/r5tJCMCwgeDwym4d7jQcHWCZLa1dWxQI/Wx2YseEU5vNBHsNilLwbLqAJ s08PLtIv0KPNM9gMmWiuJuWVI+W1/GlwLUAPiC3NuuSzYDU841AH+yCSStmG90cBHoF3 hTZqwnd8NmIb51uiBZkYNDyU8Q9QD37kS6YyPtnrFyZuHt4CXpAaIXp/f9dmBzC2Qd6Q feBJg0uZL3C2rUpUtCGQgZStVqLjdQ/pNuu9LIsc4VW1aIkHDViQmsM+vjpnug9YNE7x A9YarMDwT6EMnW/pSftwv6JMfpCAVS8xXgLiiu+Lk2sC/klNpziX4fg/iTXFdVLDpCIR Fa4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=AnJ2qoD5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si11205971ejj.377.2020.10.11.12.35.14; Sun, 11 Oct 2020 12:35:50 -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=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=AnJ2qoD5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726165AbgJKEnR (ORCPT + 99 others); Sun, 11 Oct 2020 00:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbgJKEnQ (ORCPT ); Sun, 11 Oct 2020 00:43:16 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FBD4C0613D2 for ; Sat, 10 Oct 2020 21:43:14 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id a200so10429413pfa.10 for ; Sat, 10 Oct 2020 21:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TW9KMm6OrgwSQSQ2ZasuwFiv2daX2uTGOG3qcoUMv5w=; b=AnJ2qoD5K4gRsDV2GJqxk0P/F2E7jo8rtGu952jzmVjnBt2KP9bl3aJ9JTFYGg7rqR SetWwDLPKamShb8Gwhchi78tPzG491wTQ4L/NdMLdd7bgL9/koS1faeeDbJH7HUjmO0L 2wO5oym9VV5mc8kQB0OYBN97GqdTqlZ6dyniakEy4obZPAXAf5w6redGYXQuYQD7vQ1t Mz0by5XxDlUiaD4z1KZFMaMLyc86ETL6ks6p/zjkXpmix0MvTummVGOamE17jD2RlBTx qYNf8xEl39T7D879PWYx6fO0ImO2wg/s1cVCK/yj2N5kLY15fBJtTKalwrrL4oiY1wiS 2BBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TW9KMm6OrgwSQSQ2ZasuwFiv2daX2uTGOG3qcoUMv5w=; b=L7RxMAKkF+x7AVSvJsJ+xQ1hHOIEkwXcAD18af10NV+LgIAWkxOWHXBdtwUPLyB47T fB0RScSAxNLa53CgEPiIgtjpFe90rXTLxg5PH5c22FwbdCD84Aa28oQWJ4H1PyWjFKqg R/QHoDlF3FWanTld/LQfUjrWyl4IllYEYDPhrEsPywxoPjF2q+Y8shP80zOQWGqASNRz L3hpUTvtHLfGEfkUMM1RPQMBz9AthQeqV28uI4IJJbJ2hkKcg86vUhxwR0gg9nh2QsNr jwI9GczySGgqmyggtA7R1yJczKe1pCBKY6mu/G1c3o+IyhOZwB8H1Jc82HcJprAVgRUO QRkA== X-Gm-Message-State: AOAM533nZGet4KvcGcmOlJyJbmjAcglzPVG3NlAeATSXdfZfDcfE2hLt 2DGEjPE/Fa9OplXx3JVghzbKPeJvFJU0i0J5KQCUjQ== X-Received: by 2002:a17:90a:890f:: with SMTP id u15mr13407412pjn.147.1602391393656; Sat, 10 Oct 2020 21:43:13 -0700 (PDT) MIME-Version: 1.0 References: <20201010103854.66746-1-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Sun, 11 Oct 2020 12:42:37 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo To: Randy Dunlap Cc: Greg KH , rafael@kernel.org, mst@redhat.com, jasowang@redhat.com, David Miller , kuba@kernel.org, adobriyan@gmail.com, Andrew Morton , Eric Dumazet , kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, steffen.klassert@secunet.com, herbert@gondor.apana.org.au, Shakeel Butt , Will Deacon , Michal Hocko , Roman Gushchin , neilb@suse.de, rppt@kernel.org, Sami Tolvanen , kirill.shutemov@linux.intel.com, feng.tang@intel.com, pabeni@redhat.com, Willem de Bruijn , fw@strlen.de, gustavoars@kernel.org, pablo@netfilter.org, decui@microsoft.com, jakub@cloudflare.com, Peter Zijlstra , christian.brauner@ubuntu.com, ebiederm@xmission.com, Thomas Gleixner , dave@stgolabs.net, Michel Lespinasse , Jann Horn , chenqiwu@xiaomi.com, christophe.leroy@c-s.fr, minchan@kernel.org, Martin KaFai Lau , Alexei Starovoitov , Daniel Borkmann , linmiaohe@huawei.com, Kees Cook , LKML , virtualization@lists.linux-foundation.org, Networking , linux-fsdevel@vger.kernel.org, Linux Memory Management List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 11, 2020 at 12:37 AM Randy Dunlap 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 > > --- > > 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