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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 E1D3FC433ED for ; Tue, 20 Apr 2021 13:57:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5ED6A613B0 for ; Tue, 20 Apr 2021 13:57:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5ED6A613B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AB3E36B006E; Tue, 20 Apr 2021 09:57:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8ABD6B0070; Tue, 20 Apr 2021 09:57:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 954F46B0071; Tue, 20 Apr 2021 09:57:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 7A4AF6B006E for ; Tue, 20 Apr 2021 09:57:10 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2E0B03656 for ; Tue, 20 Apr 2021 13:57:10 +0000 (UTC) X-FDA: 78052897020.12.086EDE4 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf09.hostedemail.com (Postfix) with ESMTP id 1F2706000124 for ; Tue, 20 Apr 2021 13:57:04 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1618927028; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lvmyWLVNyKpzZxwVe1+/Riv3KeBC0cRALAmWFhQu6O4=; b=Ybue4AT2OizHnD22Drd25oWnK7r4f4A/RlWeUbitxckHG/CS+Z6n08YglYyTcCvDl/qWMk GVCHakE16znkWrab0ao5hsiWgilzl99Tz/P1eqYLRoeiWSq8CiUeix6tEB3NyQP6X1kzAT 6PwkuRBVUTCEp+xqOO3xw8LY6k0S7Lg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 414FBB061; Tue, 20 Apr 2021 13:57:08 +0000 (UTC) Date: Tue, 20 Apr 2021 15:57:07 +0200 From: Michal Hocko To: Matthew Wilcox Cc: Mike Rapoport , Jonathan Corbet , Alexey Dobriyan , Andrew Morton , Eric Dumazet , Mike Rapoport , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org Subject: Re: [PATCH v2] docs: proc.rst: meminfo: briefly describe gaps in memory accounting Message-ID: References: <20210420121354.1160437-1-rppt@kernel.org> <20210420132430.GB3596236@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210420132430.GB3596236@casper.infradead.org> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1F2706000124 X-Stat-Signature: qrcj3a9b7esj5cuuosfp9whff4afid9x Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618927024-836983 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 Tue 20-04-21 14:24:30, Matthew Wilcox wrote: > On Tue, Apr 20, 2021 at 03:13:54PM +0300, Mike Rapoport wrote: > > Add a paragraph that explains that it may happen that the counters in > > /proc/meminfo do not add up to the overall memory usage. > > ... that is, the sum may be lower because memory is allocated for other > purposes that is not reported here, right? yes. Many direct page allocator users are not accounted in any of the existing counters. > Is it ever possible for it to be higher? Maybe due to a race when > sampling the counters? Yes likely possible. You will never get an atomic snapshot of all counters. > > Provides information about distribution and utilization of memory. This > > -varies by architecture and compile options. The following is from a > > -16GB PIII, which has highmem enabled. You may not have all of these fields. > > +varies by architecture and compile options. Please note that it may happen > > +that the memory accounted here does not add up to the overall memory usage > > +and the difference for some workloads can be substantial. In many cases there > > +are other means to find out additional memory using subsystem specific > > +interfaces, for instance /proc/net/sockstat for TCP memory allocations. > > How about just: > > +varies by architecture and compile options. The memory reported here > +may not add up to the overall memory usage and the difference for some > +workloads can be substantial. [...] > > But I'd like to be a bit more explicit about the reason, hence my question > above to be sure I understand. > > > It's also not entirely clear which of the fields in meminfo can be > usefully summed. VmallocTotal is larger than MemTotal, for example. Yes. Many/Most counters cannot be simply sumed up. A trivial example would be Active/Inactive is a sum of both anona and file. Mlocked will be accounted in LRU pages and Unevictable. MemAvailable is not really a counter... Usual memory consumption is usually something like LRU pages + Slab memory + kernel stack + vmalloc used + pcp. > But I know that KernelStack is allocated through vmalloc these days, > and I don't know whether VmallocUsed includes KernelStack or whether I > can sum them. Similarly, is Mlocked a subset of Unevictable? > > There is some attempt at explaining how these numbers fit together, but > it's outdated, and doesn't include Mlocked, Unevictable or KernelStack Agreed there is a lot of tribal knowledge or even misconceptions flying around and it will take much more work to put everything into shape. This is only one tiny step forward. -- Michal Hocko SUSE Labs