From patchwork Wed Jan 7 00:43:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 5578571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0C4CC9F2ED for ; Wed, 7 Jan 2015 00:47:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 307B0201EF for ; Wed, 7 Jan 2015 00:47:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C9E22010B for ; Wed, 7 Jan 2015 00:47:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y8ejI-0005RY-NO; Wed, 07 Jan 2015 00:44:08 +0000 Received: from mail.linuxfoundation.org ([140.211.169.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y8ejE-0005LB-DO for linux-arm-kernel@lists.infradead.org; Wed, 07 Jan 2015 00:44:05 +0000 Received: from akpm3.mtv.corp.google.com (unknown [216.239.45.95]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 519608FA; Wed, 7 Jan 2015 00:43:41 +0000 (UTC) Date: Tue, 6 Jan 2015 16:43:40 -0800 From: Andrew Morton To: "Wang, Yalin" Subject: Re: [RFC] mm:change meminfo cached calculation Message-Id: <20150106164340.55e83f742d6f57c19e6500ff@linux-foundation.org> In-Reply-To: <35FD53F367049845BC99AC72306C23D103EDAF89E160@CNBJMBX05.corpusers.net> References: <35FD53F367049845BC99AC72306C23D103E688B313EE@CNBJMBX05.corpusers.net> <35FD53F367049845BC99AC72306C23D103E688B313F2@CNBJMBX05.corpusers.net> <20141205143134.37139da2208c654a0d3cd942@linux-foundation.org> <35FD53F367049845BC99AC72306C23D103E688B313F4@CNBJMBX05.corpusers.net> <20141208114601.GA28846@node.dhcp.inet.fi> <35FD53F367049845BC99AC72306C23D103E688B313FB@CNBJMBX05.corpusers.net> <35FD53F367049845BC99AC72306C23D103E688B31408@CNBJMBX05.corpusers.net> <35FD53F367049845BC99AC72306C23D103EDAF89E14C@CNBJMBX05.corpusers.net> <35FD53F367049845BC99AC72306C23D103EDAF89E160@CNBJMBX05.corpusers.net> X-Mailer: Sylpheed 3.4.0beta7 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150106_164404_544019_0465EE87 X-CRM114-Status: GOOD ( 12.70 ) X-Spam-Score: -2.3 (--) Cc: "'pintu.k@samsung.com'" , "'minchan@kernel.org'" , Hugh Dickins , "'linux-kernel@vger.kernel.org'" , linux-mm@kvack.org, 'Konstantin Khlebnikov' , "'Kirill A. Shutemov'" , "'n-horiguchi@ah.jp.nec.com'" , "'linux-arm-kernel@lists.infradead.org'" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 26 Dec 2014 19:56:49 +0800 "Wang, Yalin" wrote: > This patch subtract sharedram from cached, > sharedram can only be swap into swap partitions, > they should be treated as swap pages, not as cached pages. > > ... > > --- a/fs/proc/meminfo.c > +++ b/fs/proc/meminfo.c > @@ -45,7 +45,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) > committed = percpu_counter_read_positive(&vm_committed_as); > > cached = global_page_state(NR_FILE_PAGES) - > - total_swapcache_pages() - i.bufferram; > + total_swapcache_pages() - i.bufferram - i.sharedram; > if (cached < 0) > cached = 0; Documentation/filesystems/proc.txt says : Cached: in-memory cache for files read from the disk (the : pagecache). Doesn't include SwapCached So yes, I guess it should not include shmem. And why not do this as well? --- a/Documentation/filesystems/proc.txt~mm-change-meminfo-cached-calculation-fix +++ a/Documentation/filesystems/proc.txt @@ -811,7 +811,7 @@ MemAvailable: An estimate of how much me Buffers: Relatively temporary storage for raw disk blocks shouldn't get tremendously large (20MB or so) Cached: in-memory cache for files read from the disk (the - pagecache). Doesn't include SwapCached + pagecache). Doesn't include SwapCached or Shmem. SwapCached: Memory that once was swapped out, is swapped back in but still also is in the swapfile (if memory is needed it doesn't need to be swapped out AGAIN because it is already