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, 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 7556EC433E7 for ; Sun, 11 Oct 2020 18:39:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E2637207FB for ; Sun, 11 Oct 2020 18:39:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="omOg9nng" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2637207FB 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 18672940007; Sun, 11 Oct 2020 14:39:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1371B900002; Sun, 11 Oct 2020 14:39:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F19FF940007; Sun, 11 Oct 2020 14:39:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id C52DA900002 for ; Sun, 11 Oct 2020 14:39:15 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5C77A181AE865 for ; Sun, 11 Oct 2020 18:39:15 +0000 (UTC) X-FDA: 77360507070.25.nerve99_3f10919271f4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 2E27A1804E3A0 for ; Sun, 11 Oct 2020 18:39:15 +0000 (UTC) X-HE-Tag: nerve99_3f10919271f4 X-Filterd-Recvd-Size: 5332 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Sun, 11 Oct 2020 18:39:14 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id g7so15351453iov.13 for ; Sun, 11 Oct 2020 11:39:14 -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; bh=ihDBvmS0ut4DSKeE1V92ZLXhV60yzQeKm7MqEH3UbkE=; b=omOg9nngjeH2F9Dbb/TM0VIWCX3UYpHtX8QXXKU6Wi49Z7HBxoh8JJj0LrEs6V21k+ IDFr+Xql22OeBgc7PX013oOTHyG9DTA2sG9CSgHvHnB9jsA58+YS0h7p91sSzydfrlN9 1RZg0onwhTMveQ1nYGOEpbpcfcowZoubULaRr9Q2fJ4t7bFGKDA9nAFjNnsyvFl151K9 q9wsmMGQoFNeUcKJ37tVf5HEUTY1JmYRc29u+gu6eT7BvYCiSBC12GxBgiIvtnSF8sOr JxSb58k1ZrKUUBSJmZDLdEWidS8VzAeUftUUbacInWRnlXcz3yxhcwzbam9z9Ks1E/rG M+rQ== 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=ihDBvmS0ut4DSKeE1V92ZLXhV60yzQeKm7MqEH3UbkE=; b=E0TBRBMTnhdXuHkZNeX4uJPttRJKe4ELVi56+ZJCkMjaYuyTcP8Xu1x9YmOA0WAlA6 LkvLcCPAr3x1i9jnEyU57afyhQiYPxdT7lwPn5JuvRJ94QchTpi7Uaj3sjFIRoJrupog SKb2B99JS9cFyAANtc5WL3IV3odQkGy409tdV9wepYIF43Aiy6+0J+UeryLoyYSmPHmP YyXUtfPz/hQp6VfhiaHIyyUj2LbaLVtYZXVAs3i5958JIE0eCDYTsN48VoflYdb9EoiX 8Yka+a1yAmbCi9zhEjoboLv1k+oli58zHNWdnVmfmO+jP79B3LFrcANpC5r/lqt1AAF7 MZIw== X-Gm-Message-State: AOAM533hobOyXfqzc8Y3k5lT+lCKJTgFHs+Zz1hkTpcYv+tXqHisF6vj 7l+CF5/qcXUyayCsOdZuo/ovMOK9XbezXd//xsE= X-Google-Smtp-Source: ABdhPJxTF0j2v/9fJi8BunRtQlxMSiClZGK5c3sE9XRmWV7VBvPIX40VOP59eN5kOLWvuAg4icWlgLsDpVCM1/QHaos= X-Received: by 2002:a02:94cd:: with SMTP id x71mr16450243jah.124.1602441553813; Sun, 11 Oct 2020 11:39:13 -0700 (PDT) MIME-Version: 1.0 References: <20201010103854.66746-1-songmuchun@bytedance.com> In-Reply-To: <20201010103854.66746-1-songmuchun@bytedance.com> From: Cong Wang Date: Sun, 11 Oct 2020 11:39:02 -0700 Message-ID: Subject: 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 , shakeelb@google.com, will@kernel.org, Michal Hocko , Roman Gushchin , Neil Brown , rppt@kernel.org, samitolvanen@google.com, "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, walken@google.com, 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" 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 Sat, Oct 10, 2020 at 3:39 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 We do it via `ss -m`. Is it not sufficient? And if not, why not adding it there rather than /proc/meminfo? > static inline void __skb_frag_unref(skb_frag_t *frag) > { > - put_page(skb_frag_page(frag)); > + struct page *page = 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 exactly 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(). Thanks.