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=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 2E0ADC433DF for ; Mon, 19 Oct 2020 17:23:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3A4D2224D for ; Mon, 19 Oct 2020 17:23:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="o9jkQBUp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730938AbgJSRXk (ORCPT ); Mon, 19 Oct 2020 13:23:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730186AbgJSRXk (ORCPT ); Mon, 19 Oct 2020 13:23:40 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE54C0613CE for ; Mon, 19 Oct 2020 10:23:39 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id h6so452022lfj.3 for ; Mon, 19 Oct 2020 10:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iyXXWfOQa+1d+k4Kfi8s1b5PhoxBW70UL1MRANY5iTA=; b=o9jkQBUpkBGEwOPcru1DIzTI4hADMkSZb2pfw2EQWRKUHSYKt6lOgBGbe0/PbjBsyj gkCeKyOJfMcHu8JQBuIGXYq2bMyUO23p7qpUH07+K7VJuHC15dj9M6Jixv+0kGJ3I484 bibfM3wj1lSg02RVEGxrX4Vn06BnYQ9Fkpzq6GOiAp/P6ZC5OVnYSRqS0zxc14K0j6WJ cCjXupRPGQ3TQDsCBLaS0PxaOBRob35h4AyY0tvNebkGYNGxcnr2o07kc5d9g5o6COFY ILq2uDK4Y0klCUbaiEoIjmZxvz8kx/FNpsGUPC+D11xVFrfoxaJk055Yiql09wfYplO5 TC/w== 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=iyXXWfOQa+1d+k4Kfi8s1b5PhoxBW70UL1MRANY5iTA=; b=YZLwLqLs169sagr8hAmnobRY+Nxo3FRhvsBUL9qlPt6Dumur7ZA90pJnrd4nu7b1fd DHDk201PMWDsOU9QAk2PFqgKAnSt+6SUQkjdQ3gS4rJ2+QkElF22pUicS6t8MfsvTbzk JlagHL42ZQC3cQ+AuHuomqBljjBddw6dcrqYZZ0bXrLwmrt3GPxfRGTLHgxa+Rb7fZEy 8gEwaOnJhJhbOT8H11y9+W4f2FizqiImwvdKQE6+KxA8MlA0AL/Ih5ttI6PDVhGAp8vS pFzmlpdivcOrzuN0+/OX/H1gkScNWOqIVAehP8ixCGJMlVn0WQFAosI++cnZvlISQn83 ZkHQ== X-Gm-Message-State: AOAM533RKq7FrtUKfCg1SqpD9Sx7J99RksnjPWiaHEEYcQO1RESZPAVw /4Z3K4IW3Y6Jg5jWfnIPITAZkaoEW213FVSLnNlB6A== X-Google-Smtp-Source: ABdhPJwSXb1dY6AgaVzNQLt+reDscKrvoARfXRBXfeo2h9MZNArk1CXUTqLg5bs0YhI3mYrfPTwBL8qmTMYBnfbcX4E= X-Received: by 2002:a19:d10:: with SMTP id 16mr216317lfn.385.1603128217818; Mon, 19 Oct 2020 10:23:37 -0700 (PDT) MIME-Version: 1.0 References: <20201010103854.66746-1-songmuchun@bytedance.com> <9262ea44-fc3a-0b30-54dd-526e16df85d1@gmail.com> <20201013080906.GD4251@kernel.org> <8d1558e7-cd09-1f9e-edab-5f22c5bfc342@suse.cz> <20201016205336.GE1976566@google.com> In-Reply-To: <20201016205336.GE1976566@google.com> From: Shakeel Butt Date: Mon, 19 Oct 2020 10:23:26 -0700 Message-ID: Subject: Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo To: Minchan Kim , Paolo Bonzini Cc: Vlastimil Babka , Mike Rapoport , Muchun Song , Eric Dumazet , Eric Dumazet , Cong Wang , Greg KH , rafael@kernel.org, "Michael S. Tsirkin" , Jason Wang , David Miller , Jakub Kicinski , Alexey Dobriyan , Andrew Morton , Alexey Kuznetsov , Hideaki YOSHIFUJI , Steffen Klassert , Herbert Xu , Will Deacon , Michal Hocko , Roman Gushchin , Neil Brown , Sami Tolvanen , "Kirill A. Shutemov" , Feng Tang , Paolo Abeni , Willem de Bruijn , Randy Dunlap , Florian Westphal , gustavoars@kernel.org, Pablo Neira Ayuso , Dexuan Cui , Jakub Sitnicki , Peter Zijlstra , Christian Brauner , "Eric W. Biederman" , Thomas Gleixner , Davidlohr Bueso , Michel Lespinasse , Jann Horn , chenqiwu@xiaomi.com, Christophe Leroy , 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 , Michael Kerrisk Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CCed: Paolo Bonzini On Fri, Oct 16, 2020 at 1:53 PM Minchan Kim wrote: [snip] > > And there might be others, and adding everything to /proc/meminfo is not > > feasible. I have once proposed adding a counter called "Unaccounted:" which > > would at least tell the user easily if a significant portion is occupied by > > memory not explained by the other meminfo counters, and look for trends > > (increase = potential memory leak?). For specific prominent consumers not > > covered by meminfo but that have some kind of internal counters, we could > > document where to look, such as /proc/net/sockstat or maybe create some > > /proc/ or /sys directory with file per consumer so that it's still easy to > > check, but without the overhead of global counters and bloated > > /proc/meminfo? > > What have in my mind is to support simple general sysfs infra from MM for > driver/subysstems rather than creating each own memory stat. The API > could support flexible accounting like just global memory consumption and/or > consmption by key(e.g,. pid or each own special) for the detail. > > So, they are all shown under /sys/kernel/mm/misc/ with detail as well as > /proc/meminfo with simple line for global. This reminds me of statsfs [1]. I am wondering if this can be another useful use-case for statsfs. [1] https://lkml.org/lkml/2020/5/26/332 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=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 29F32C433E7 for ; Mon, 19 Oct 2020 17:23:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6CA9122282 for ; Mon, 19 Oct 2020 17:23:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="o9jkQBUp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CA9122282 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 94BE66B005D; Mon, 19 Oct 2020 13:23:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FDD06B0062; Mon, 19 Oct 2020 13:23:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79AD66B0068; Mon, 19 Oct 2020 13:23:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id 4AD836B005D for ; Mon, 19 Oct 2020 13:23:42 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 519C11EE6 for ; Mon, 19 Oct 2020 17:23:41 +0000 (UTC) X-FDA: 77389347042.28.print35_0d1006427238 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 191206C05 for ; Mon, 19 Oct 2020 17:23:40 +0000 (UTC) X-HE-Tag: print35_0d1006427238 X-Filterd-Recvd-Size: 6508 Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Mon, 19 Oct 2020 17:23:39 +0000 (UTC) Received: by mail-lf1-f67.google.com with SMTP id j30so446809lfp.4 for ; Mon, 19 Oct 2020 10:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iyXXWfOQa+1d+k4Kfi8s1b5PhoxBW70UL1MRANY5iTA=; b=o9jkQBUpkBGEwOPcru1DIzTI4hADMkSZb2pfw2EQWRKUHSYKt6lOgBGbe0/PbjBsyj gkCeKyOJfMcHu8JQBuIGXYq2bMyUO23p7qpUH07+K7VJuHC15dj9M6Jixv+0kGJ3I484 bibfM3wj1lSg02RVEGxrX4Vn06BnYQ9Fkpzq6GOiAp/P6ZC5OVnYSRqS0zxc14K0j6WJ cCjXupRPGQ3TQDsCBLaS0PxaOBRob35h4AyY0tvNebkGYNGxcnr2o07kc5d9g5o6COFY ILq2uDK4Y0klCUbaiEoIjmZxvz8kx/FNpsGUPC+D11xVFrfoxaJk055Yiql09wfYplO5 TC/w== 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=iyXXWfOQa+1d+k4Kfi8s1b5PhoxBW70UL1MRANY5iTA=; b=D7tvbQM4CpALmyvMxvXim6QNldJW5WA5g2EM/oNxJxrvcgylUMgdWO6H8IcUkBY7eJ aqJRA4B8c7z6m6+uRyHiD+/qxYWO+p0UlhwfBGXNAmHmYRz9d2JPbUYyTXC9W1SFdh90 U47+3yrhBkf+rwbHJS+LZwAiOkb1koRAJMdBMJ/xmaA5abg0wtZ1EHgB0sgpM01pVHCr lfQfM3HEAUsq+t5s2JOmO3xhjLTrAGfk81IHa+QRXK4ow463DJY8qDyoKYSPH5HvttpF d8bHNVg+Xi0+CPb5v0fnm+m3YFMnwueu5sEiHwSJqrQ6+CfgJnvrNadhGWOxUQ4Rnbnl Jmag== X-Gm-Message-State: AOAM532CuModF1ztNJhKSm8U7Oz+4+jqnlsfEGfLDWAgPLWDC6vu61IM nSUMyH/L/B9xnc/2QnvvMrqLzW0pfP8A+rXC7nB0jQ== X-Google-Smtp-Source: ABdhPJwSXb1dY6AgaVzNQLt+reDscKrvoARfXRBXfeo2h9MZNArk1CXUTqLg5bs0YhI3mYrfPTwBL8qmTMYBnfbcX4E= X-Received: by 2002:a19:d10:: with SMTP id 16mr216317lfn.385.1603128217818; Mon, 19 Oct 2020 10:23:37 -0700 (PDT) MIME-Version: 1.0 References: <20201010103854.66746-1-songmuchun@bytedance.com> <9262ea44-fc3a-0b30-54dd-526e16df85d1@gmail.com> <20201013080906.GD4251@kernel.org> <8d1558e7-cd09-1f9e-edab-5f22c5bfc342@suse.cz> <20201016205336.GE1976566@google.com> In-Reply-To: <20201016205336.GE1976566@google.com> From: Shakeel Butt Date: Mon, 19 Oct 2020 10:23:26 -0700 Message-ID: Subject: Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo To: Minchan Kim , Paolo Bonzini Cc: Vlastimil Babka , Mike Rapoport , Muchun Song , Eric Dumazet , Eric Dumazet , Cong Wang , Greg KH , rafael@kernel.org, "Michael S. Tsirkin" , Jason Wang , David Miller , Jakub Kicinski , Alexey Dobriyan , Andrew Morton , Alexey Kuznetsov , Hideaki YOSHIFUJI , Steffen Klassert , Herbert Xu , Will Deacon , Michal Hocko , Roman Gushchin , Neil Brown , Sami Tolvanen , "Kirill A. Shutemov" , Feng Tang , Paolo Abeni , Willem de Bruijn , Randy Dunlap , Florian Westphal , gustavoars@kernel.org, Pablo Neira Ayuso , Dexuan Cui , Jakub Sitnicki , Peter Zijlstra , Christian Brauner , "Eric W. Biederman" , Thomas Gleixner , Davidlohr Bueso , Michel Lespinasse , Jann Horn , chenqiwu@xiaomi.com, Christophe Leroy , 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 , Michael Kerrisk 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: CCed: Paolo Bonzini On Fri, Oct 16, 2020 at 1:53 PM Minchan Kim wrote: [snip] > > And there might be others, and adding everything to /proc/meminfo is not > > feasible. I have once proposed adding a counter called "Unaccounted:" which > > would at least tell the user easily if a significant portion is occupied by > > memory not explained by the other meminfo counters, and look for trends > > (increase = potential memory leak?). For specific prominent consumers not > > covered by meminfo but that have some kind of internal counters, we could > > document where to look, such as /proc/net/sockstat or maybe create some > > /proc/ or /sys directory with file per consumer so that it's still easy to > > check, but without the overhead of global counters and bloated > > /proc/meminfo? > > What have in my mind is to support simple general sysfs infra from MM for > driver/subysstems rather than creating each own memory stat. The API > could support flexible accounting like just global memory consumption and/or > consmption by key(e.g,. pid or each own special) for the detail. > > So, they are all shown under /sys/kernel/mm/misc/ with detail as well as > /proc/meminfo with simple line for global. This reminds me of statsfs [1]. I am wondering if this can be another useful use-case for statsfs. [1] https://lkml.org/lkml/2020/5/26/332