From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1309C433E7 for ; Mon, 12 Oct 2020 21:47:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5ACAF20878 for ; Mon, 12 Oct 2020 21:47:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sYImlSuW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730949AbgJLVrE (ORCPT ); Mon, 12 Oct 2020 17:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730022AbgJLVrD (ORCPT ); Mon, 12 Oct 2020 17:47:03 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A060CC0613D0; Mon, 12 Oct 2020 14:47:03 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id l8so19172577ioh.11; Mon, 12 Oct 2020 14:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=h+F8apYj2Plr5dGtsp4Sn87icM0Gt/ZYiDUCGu5uXTA=; b=sYImlSuWHY/0f/jfbP/5+gVgcuqOAtQjUMnXMHXED5umjtE3LPslOSL7etCXMHOofP OCpa+2Sz42CDxUNykjUuDhWyt5vFu1VQ2q4mLxaSnkvM0BeJYsRX2yVIf69oRTE9T67o HRSY3XMYMW81cX286ZryHP3m3P/6kZ5ItQS7iUkubm19T+mUJGaXaGWyUNZdJtMqQgmL zSpO8tHo17YhrEljp7eptvHzAhmOHFf/hJvg/N0IaJaR5HkeDupWi3U14lijEclKn9qq MEwXGSOFD9iX8EgjReyyv2j7VDxt6rk3rEUTRz5EOYXiuvy4JelYIs/WB2F89KX73aVI Mp9w== 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:content-transfer-encoding; bh=h+F8apYj2Plr5dGtsp4Sn87icM0Gt/ZYiDUCGu5uXTA=; b=bw4nJYFsH3L6LXwBI0dvBAu3GG/YkGgk2gSymw9Jm2G8SbKXb0pDY69YJSD3b0XObx 7Q79hcTiYmydzI+UJa7vP95O1ZYRHwQNGeTQ3ak6iSQkbpkZGJ8C9R4hyUgP9X/rJGtK XrcA4V4GVIWgv9rg2fneiEijdkQhejhtWD/GnEQrqt1+oPgNoeTFDXgu2uY7hCtmk6AS Q8WrM4KMdHzLKRAobosryi60chagneE+Uedi3xrAi3uITKErio06oFfyd25WnRJdpStv gQuFmpUCrKcDkVOLrZcJrR38TphVDNmsZelza0YEel1QJPDoSUqrhNiXL7ZxiAwkNkmz uTAQ== X-Gm-Message-State: AOAM532ts66YoeTI3X4kC+fMw0c/khNRe5tnLbHMVznDUFdh0nqzbbvB dNg/QN1JjD3RwT3SFKGzHqgEh9oPqhGqeL1KuIo= X-Google-Smtp-Source: ABdhPJz+y8paHziZjzqkLnzbjCoDFkO2pq2nRDQe31YPP796UzqDxRo9ZdyGommWTE6TqDzyP+Mz9TyqV84szZZPZVw= X-Received: by 2002:a02:94cd:: with SMTP id x71mr20173978jah.124.1602539222864; Mon, 12 Oct 2020 14:47:02 -0700 (PDT) MIME-Version: 1.0 References: <20201010103854.66746-1-songmuchun@bytedance.com> In-Reply-To: From: Cong Wang Date: Mon, 12 Oct 2020 14:46:51 -0700 Message-ID: Subject: Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo To: Muchun Song Cc: Greg KH , rafael@kernel.org, "Michael S. Tsirkin" , Jason Wang , David Miller , Jakub Kicinski , Alexey Dobriyan , Andrew Morton , Eric Dumazet , Alexey Kuznetsov , Hideaki YOSHIFUJI , Steffen Klassert , Herbert Xu , Shakeel Butt , Will Deacon , Michal Hocko , Roman Gushchin , Neil Brown , rppt@kernel.org, Sami Tolvanen , "Kirill A. Shutemov" , Feng Tang , Paolo Abeni , Willem de Bruijn , Randy Dunlap , Florian Westphal , gustavoars@kernel.org, Pablo Neira Ayuso , decui@microsoft.com, Jakub Sitnicki , Peter Zijlstra , Christian Brauner , "Eric W. Biederman" , Thomas Gleixner , dave@stgolabs.net, Michel Lespinasse , Jann Horn , chenqiwu@xiaomi.com, christophe.leroy@c-s.fr, Minchan Kim , Martin KaFai Lau , Alexei Starovoitov , Daniel Borkmann , Miaohe Lin , Kees Cook , LKML , virtualization@lists.linux-foundation.org, Linux Kernel Network Developers , linux-fsdevel , linux-mm Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 11, 2020 at 9:22 PM Muchun Song wrot= e: > > On Mon, Oct 12, 2020 at 2:39 AM Cong Wang wrot= e: > > > > On Sat, Oct 10, 2020 at 3:39 AM Muchun Song = wrote: > > > > > > The amount of memory allocated to sockets buffer can become significa= nt. > > > However, we do not display the amount of memory consumed by sockets > > > buffer. In this case, knowing where the memory is consumed by the ker= nel > > > > We do it via `ss -m`. Is it not sufficient? And if not, why not adding = it there > > rather than /proc/meminfo? > > If the system has little free memory, we can know where the memory is via > /proc/meminfo. If a lot of memory is consumed by socket buffer, we cannot > know it when the Sock is not shown in the /proc/meminfo. If the unaware u= ser > can't think of the socket buffer, naturally they will not `ss -m`. The > end result Interesting, we already have a few counters related to socket buffers, are you saying these are not accounted in /proc/meminfo either? If yes, why are page frags so special here? If not, they are more important than page frags, so you probably want to deal with them first. > is that we still don=E2=80=99t know where the memory is consumed. And we = add the > Sock to the /proc/meminfo just like the memcg does('sock' item in the cgr= oup > v2 memory.stat). So I think that adding to /proc/meminfo is sufficient. It looks like actually the socket page frag is already accounted, for example, the tcp_sendmsg_locked(): copy =3D min_t(int, copy, pfrag->size - pfrag->offs= et); if (!sk_wmem_schedule(sk, copy)) goto wait_for_memory; > > > > > > static inline void __skb_frag_unref(skb_frag_t *frag) > > > { > > > - put_page(skb_frag_page(frag)); > > > + struct page *page =3D skb_frag_page(frag); > > > + > > > + if (put_page_testzero(page)) { > > > + dec_sock_node_page_state(page); > > > + __put_page(page); > > > + } > > > } > > > > You mix socket page frag with skb frag at least, not sure this is exact= ly > > what you want, because clearly skb page frags are frequently used > > by network drivers rather than sockets. > > > > Also, which one matches this dec_sock_node_page_state()? Clearly > > not skb_fill_page_desc() or __skb_frag_ref(). > > Yeah, we call inc_sock_node_page_state() in the skb_page_frag_refill(). How is skb_page_frag_refill() possibly paired with __skb_frag_unref()? > So if someone gets the page returned by skb_page_frag_refill(), it must > put the page via __skb_frag_unref()/skb_frag_unref(). We use PG_private > to indicate that we need to dec the node page state when the refcount of > page reaches zero. skb_page_frag_refill() is called on frags not within an skb, for instance, sk_page_frag_refill() uses it for a per-socket or per-process page frag. But, __skb_frag_unref() is specifically used for skb frags, which are supposed to be filled by skb_fill_page_desc() (page is allocated by driver)= . They are different things you are mixing them up, which looks clearly wrong or at least misleading. Thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8269EC43457 for ; Mon, 12 Oct 2020 21:47:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DBA4320797 for ; Mon, 12 Oct 2020 21:47:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sYImlSuW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBA4320797 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 089A0940007; Mon, 12 Oct 2020 17:47:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 03BE5900002; Mon, 12 Oct 2020 17:47:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E20A9940007; Mon, 12 Oct 2020 17:47:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id B6816900002 for ; Mon, 12 Oct 2020 17:47:04 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4E925180AD815 for ; Mon, 12 Oct 2020 21:47:04 +0000 (UTC) X-FDA: 77364609168.30.cry89_130b0a1271fd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 26AF8180B3C8B for ; Mon, 12 Oct 2020 21:47:04 +0000 (UTC) X-HE-Tag: cry89_130b0a1271fd X-Filterd-Recvd-Size: 7946 Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Mon, 12 Oct 2020 21:47:03 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id y20so15078936iod.5 for ; Mon, 12 Oct 2020 14:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=h+F8apYj2Plr5dGtsp4Sn87icM0Gt/ZYiDUCGu5uXTA=; b=sYImlSuWHY/0f/jfbP/5+gVgcuqOAtQjUMnXMHXED5umjtE3LPslOSL7etCXMHOofP OCpa+2Sz42CDxUNykjUuDhWyt5vFu1VQ2q4mLxaSnkvM0BeJYsRX2yVIf69oRTE9T67o HRSY3XMYMW81cX286ZryHP3m3P/6kZ5ItQS7iUkubm19T+mUJGaXaGWyUNZdJtMqQgmL zSpO8tHo17YhrEljp7eptvHzAhmOHFf/hJvg/N0IaJaR5HkeDupWi3U14lijEclKn9qq MEwXGSOFD9iX8EgjReyyv2j7VDxt6rk3rEUTRz5EOYXiuvy4JelYIs/WB2F89KX73aVI Mp9w== 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:content-transfer-encoding; bh=h+F8apYj2Plr5dGtsp4Sn87icM0Gt/ZYiDUCGu5uXTA=; b=kdZr93zkZ2rZvT1OCkcDOYANa4JZkE5VtXQPBfPx0iRCSH2UPQ9fLJk2U7w1B5v21p 7HmuAD5TjN4dS1DFhreKGOgX5lz7/Ce1PJeMT0Lp8d0VOLUag0bwKBStT9M7Y9Qmesno XxjdgawrPZGvTQHjpNeNfn3U+ONGhCBrBTgWohTxL2yvSNdBCvlr9ZNbV72ds/ChfzSr 3XHiyvRb971q2a6ArGv54aJDOpaMl7ZsRPHUAcHIMBR7ZZQ8ztrT87/ffD2YmuJ6sCrj Gyv0jfqKSzAyh2AthbgLfX54LRmEEIi5FYHD3tc15Dld8I0blRqZWtOJ54XLj2M7t43A hymw== X-Gm-Message-State: AOAM531Fz1sn8ZHcNcaVxY10AyBJImF4pIiOX01h9a4GiYEgyAVwlD77 rrEhSRUcgJ92IeAKVui6a1kgZX5r18JAdzdZOtM= X-Google-Smtp-Source: ABdhPJz+y8paHziZjzqkLnzbjCoDFkO2pq2nRDQe31YPP796UzqDxRo9ZdyGommWTE6TqDzyP+Mz9TyqV84szZZPZVw= X-Received: by 2002:a02:94cd:: with SMTP id x71mr20173978jah.124.1602539222864; Mon, 12 Oct 2020 14:47:02 -0700 (PDT) MIME-Version: 1.0 References: <20201010103854.66746-1-songmuchun@bytedance.com> In-Reply-To: From: Cong Wang Date: Mon, 12 Oct 2020 14:46:51 -0700 Message-ID: Subject: Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo To: Muchun Song Cc: Greg KH , rafael@kernel.org, "Michael S. Tsirkin" , Jason Wang , David Miller , Jakub Kicinski , Alexey Dobriyan , Andrew Morton , Eric Dumazet , Alexey Kuznetsov , Hideaki YOSHIFUJI , Steffen Klassert , Herbert Xu , Shakeel Butt , Will Deacon , Michal Hocko , Roman Gushchin , Neil Brown , rppt@kernel.org, Sami Tolvanen , "Kirill A. Shutemov" , Feng Tang , Paolo Abeni , Willem de Bruijn , Randy Dunlap , Florian Westphal , gustavoars@kernel.org, Pablo Neira Ayuso , decui@microsoft.com, Jakub Sitnicki , Peter Zijlstra , Christian Brauner , "Eric W. Biederman" , Thomas Gleixner , dave@stgolabs.net, Michel Lespinasse , Jann Horn , chenqiwu@xiaomi.com, christophe.leroy@c-s.fr, Minchan Kim , Martin KaFai Lau , Alexei Starovoitov , Daniel Borkmann , Miaohe Lin , Kees Cook , LKML , virtualization@lists.linux-foundation.org, Linux Kernel Network Developers , linux-fsdevel , linux-mm Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Oct 11, 2020 at 9:22 PM Muchun Song wrot= e: > > On Mon, Oct 12, 2020 at 2:39 AM Cong Wang wrot= e: > > > > On Sat, Oct 10, 2020 at 3:39 AM Muchun Song = wrote: > > > > > > The amount of memory allocated to sockets buffer can become significa= nt. > > > However, we do not display the amount of memory consumed by sockets > > > buffer. In this case, knowing where the memory is consumed by the ker= nel > > > > We do it via `ss -m`. Is it not sufficient? And if not, why not adding = it there > > rather than /proc/meminfo? > > If the system has little free memory, we can know where the memory is via > /proc/meminfo. If a lot of memory is consumed by socket buffer, we cannot > know it when the Sock is not shown in the /proc/meminfo. If the unaware u= ser > can't think of the socket buffer, naturally they will not `ss -m`. The > end result Interesting, we already have a few counters related to socket buffers, are you saying these are not accounted in /proc/meminfo either? If yes, why are page frags so special here? If not, they are more important than page frags, so you probably want to deal with them first. > is that we still don=E2=80=99t know where the memory is consumed. And we = add the > Sock to the /proc/meminfo just like the memcg does('sock' item in the cgr= oup > v2 memory.stat). So I think that adding to /proc/meminfo is sufficient. It looks like actually the socket page frag is already accounted, for example, the tcp_sendmsg_locked(): copy =3D min_t(int, copy, pfrag->size - pfrag->offs= et); if (!sk_wmem_schedule(sk, copy)) goto wait_for_memory; > > > > > > static inline void __skb_frag_unref(skb_frag_t *frag) > > > { > > > - put_page(skb_frag_page(frag)); > > > + struct page *page =3D skb_frag_page(frag); > > > + > > > + if (put_page_testzero(page)) { > > > + dec_sock_node_page_state(page); > > > + __put_page(page); > > > + } > > > } > > > > You mix socket page frag with skb frag at least, not sure this is exact= ly > > what you want, because clearly skb page frags are frequently used > > by network drivers rather than sockets. > > > > Also, which one matches this dec_sock_node_page_state()? Clearly > > not skb_fill_page_desc() or __skb_frag_ref(). > > Yeah, we call inc_sock_node_page_state() in the skb_page_frag_refill(). How is skb_page_frag_refill() possibly paired with __skb_frag_unref()? > So if someone gets the page returned by skb_page_frag_refill(), it must > put the page via __skb_frag_unref()/skb_frag_unref(). We use PG_private > to indicate that we need to dec the node page state when the refcount of > page reaches zero. skb_page_frag_refill() is called on frags not within an skb, for instance, sk_page_frag_refill() uses it for a per-socket or per-process page frag. But, __skb_frag_unref() is specifically used for skb frags, which are supposed to be filled by skb_fill_page_desc() (page is allocated by driver)= . They are different things you are mixing them up, which looks clearly wrong or at least misleading. Thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9301C4363A for ; Mon, 12 Oct 2020 21:47:08 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 365E4208D5 for ; Mon, 12 Oct 2020 21:47:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sYImlSuW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 365E4208D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 86D1D86D33; Mon, 12 Oct 2020 21:47:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l35GJLG8lRkM; Mon, 12 Oct 2020 21:47:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id EAEFE86BBF; Mon, 12 Oct 2020 21:47:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D7D76C07FF; Mon, 12 Oct 2020 21:47:05 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9D571C0051 for ; Mon, 12 Oct 2020 21:47:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8DC7886BBF for ; Mon, 12 Oct 2020 21:47:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jpkj7oueGgCs for ; Mon, 12 Oct 2020 21:47:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id ADC4886BBE for ; Mon, 12 Oct 2020 21:47:03 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id k6so19226937ior.2 for ; Mon, 12 Oct 2020 14:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=h+F8apYj2Plr5dGtsp4Sn87icM0Gt/ZYiDUCGu5uXTA=; b=sYImlSuWHY/0f/jfbP/5+gVgcuqOAtQjUMnXMHXED5umjtE3LPslOSL7etCXMHOofP OCpa+2Sz42CDxUNykjUuDhWyt5vFu1VQ2q4mLxaSnkvM0BeJYsRX2yVIf69oRTE9T67o HRSY3XMYMW81cX286ZryHP3m3P/6kZ5ItQS7iUkubm19T+mUJGaXaGWyUNZdJtMqQgmL zSpO8tHo17YhrEljp7eptvHzAhmOHFf/hJvg/N0IaJaR5HkeDupWi3U14lijEclKn9qq MEwXGSOFD9iX8EgjReyyv2j7VDxt6rk3rEUTRz5EOYXiuvy4JelYIs/WB2F89KX73aVI Mp9w== 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:content-transfer-encoding; bh=h+F8apYj2Plr5dGtsp4Sn87icM0Gt/ZYiDUCGu5uXTA=; b=BSLMcJbPCW9DtYbEwcrvZ8eSD9tMWf0FpVq54v7+enTipYf7TlZ9xzk4cETGfxxIpC 2fU9qXw7eChJz8el5sN5FbiZdKp1V7wCB5xwBdoUK+I+RozA+6wVMuZI0q78Ml2dOp0M luIH73XfTMRi1teO/arQn4jUs/Auzi6LQDIh5NA3X4OD1cKXQyAistoz77Uiyuk/yFmj hpMl+bwc4Kk4MzYsOwTMuHCOa17D44nJtZ8K+UYL16KqjZ2JeHt4XpvLwLDxJDWGgfeZ 72V7IX8oDLCSJfTqbWxkiDAipUvdBkjGx/tfsfIDWXKut3eeXvd+JNbz/f5Kn2Q0MUOF 5mqw== X-Gm-Message-State: AOAM530fhsQLyoJSk9n5wAexBem9bbghevtDIzIVj7yiVejxiznb7rLS PJZeCAX7GXKW+NDl2etwUdm9odcFe3SUMeghLrE= X-Google-Smtp-Source: ABdhPJz+y8paHziZjzqkLnzbjCoDFkO2pq2nRDQe31YPP796UzqDxRo9ZdyGommWTE6TqDzyP+Mz9TyqV84szZZPZVw= X-Received: by 2002:a02:94cd:: with SMTP id x71mr20173978jah.124.1602539222864; Mon, 12 Oct 2020 14:47:02 -0700 (PDT) MIME-Version: 1.0 References: <20201010103854.66746-1-songmuchun@bytedance.com> In-Reply-To: From: Cong Wang Date: Mon, 12 Oct 2020 14:46:51 -0700 Message-ID: Subject: Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo To: Muchun Song Cc: Miaohe Lin , Feng Tang , Michal Hocko , "Michael S. Tsirkin" , Neil Brown , Alexei Starovoitov , LKML , linux-mm , Eric Dumazet , Christian Brauner , Michel Lespinasse , Will Deacon , Steffen Klassert , dave@stgolabs.net, Herbert Xu , Daniel Borkmann , rafael@kernel.org, decui@microsoft.com, Peter Zijlstra , Sami Tolvanen , Alexey Kuznetsov , Paolo Abeni , Alexey Dobriyan , Pablo Neira Ayuso , "Eric W. Biederman" , Kees Cook , Jann Horn , Shakeel Butt , Jakub Kicinski , Thomas Gleixner , virtualization@lists.linux-foundation.org, chenqiwu@xiaomi.com, Martin KaFai Lau , Jakub Sitnicki , christophe.leroy@c-s.fr, Willem de Bruijn , Hideaki YOSHIFUJI , Greg KH , Randy Dunlap , Florian Westphal , gustavoars@kernel.org, Roman Gushchin , Minchan Kim , rppt@kernel.org, Linux Kernel Network Developers , linux-fsdevel , Andrew Morton , David Miller , "Kirill A. Shutemov" X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Err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