Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3661372pxu; Sun, 11 Oct 2020 19:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ8njvMu/l2sDjMjIakcwp0bWiBjBe5ntS9jA4R1rK0/xn5+4huUwtJ0QeIern1bvANZJQ X-Received: by 2002:a50:80e3:: with SMTP id 90mr12107953edb.39.1602468842063; Sun, 11 Oct 2020 19:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602468842; cv=none; d=google.com; s=arc-20160816; b=fGZM5jNV3zIZ8vFAht1ZY2ythF8Fb/nxGonmtCfBGLddl4Rxm/fjgEIq+NA1Mlymm9 K8uH7cAsiY1A2p0ybcntbt+J2rRKMDl1lMUIiMgOc2cf2z+6sOmaw4r0dma0AuPStpsj gwUttrceCYqmbKq2spkrVpGPIAa/uXEpjQ58uEjvXLkwy/Y4JPE+rldHDxfoOD9BHDNT Brg6GKWx3KccnEdquUkxodboiCd+J8uRIfNIdpNevM5UfSzphaQ2E+HGG7/Ja0ddx+hn f6Nfufg4RmHio5vCXs/xbP93vLLFRkGoWU+A3XaFq4VJOwBMiVvkJdt9AkBWnFuiMBmG qELA== 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=ihDBvmS0ut4DSKeE1V92ZLXhV60yzQeKm7MqEH3UbkE=; b=OXzqNhIKm2XmE2b9MzUy8FOyBtmkJ9hrt394O8DeZaeNhcz2/zxbvcTC4c7Eafrqs3 0deki09DjbW/VGy3LaWdbR69wBvbtwOC4sMm0vmzHewK/EaFwv/ozqAIzN2GTh87MJ9x ZLk/0X3OnLCwvvAzK4Zo9wYzg9OX4ZWDPK01+8Kn4z05TXzTSGY33ACd263+AWu2B+nl I6dNsxiX6OUe8lUifiCyo1Qaz+kfIue98etnSyGCOPmriP1rDZUUed873g9Tu+7GrNqc EYvsErmwATumqQ8acwod9zHZixdrfqGtIdmdtO8S9iycKZcmGm3r78Hpjo1p/Gmp+r6U IXUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=omOg9nng; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si2340216edn.64.2020.10.11.19.13.39; Sun, 11 Oct 2020 19:14:02 -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=@gmail.com header.s=20161025 header.b=omOg9nng; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727138AbgJKSjP (ORCPT + 99 others); Sun, 11 Oct 2020 14:39:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbgJKSjO (ORCPT ); Sun, 11 Oct 2020 14:39:14 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8EF5C0613CE; Sun, 11 Oct 2020 11:39:14 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id n6so15408703ioc.12; 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=D+EAFSUk3J51UIdkkq3UkZPSDDTjY2/IblHALbwE+PiISRa6LtRA6TKuQcnYmqN3TB 05zhewBOJwNwjhem1D+aRIXNdsr2grfkRKC5Yi7/QsOB3PUg/oZE2B6y35zP1uj2Sh+s F//Vrp92fQNh/zmfusPsyuUF9cshQDfD/n+mgSiT0Pi0gJgheIiqIRIATWqU8MvrXi5i cNABOR9Ze5leObSH9HyR7+lj1uUKFJnSlWlEnhh3meVOCdKdjPVhZQ4eu3PplH9hLdmZ cQwCiHNrUB/AzADULoZy+2JVdp5ELKG/6tx43k7jrNdU/3YotoE1AOR4f+Se3ZyOggW6 mFJA== X-Gm-Message-State: AOAM531Pal6LIqdUgYuKzZYOfmNFagpifflmi284He1d1RxHTQJW+Ruu VT+OcdW8cAEEa44EcVDxd6M7lIiBvXGszslyzg8= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.