From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932432AbcHIS3B (ORCPT ); Tue, 9 Aug 2016 14:29:01 -0400 Received: from mail-yw0-f177.google.com ([209.85.161.177]:35965 "EHLO mail-yw0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932257AbcHIS27 (ORCPT ); Tue, 9 Aug 2016 14:28:59 -0400 MIME-Version: 1.0 In-Reply-To: <20160809165840.GA18881@p183.telecom.by> References: <1470758743-17685-1-git-send-email-robert.foss@collabora.com> <20160809165840.GA18881@p183.telecom.by> From: Sonny Rao Date: Tue, 9 Aug 2016 11:28:36 -0700 X-Google-Sender-Auth: IIjAN283xL1BBebBBkKAlqpjRKc Message-ID: Subject: Re: [PACTH v1] mm, proc: Implement /proc//totmaps To: Alexey Dobriyan Cc: Robert Foss , Andrew Morton , Kees Cook , viro@zeniv.linux.org.uk, gorcunov@openvz.org, John Stultz , Robin Humble , Mateusz Guzik , Janis Danisevskis , calvinowens@fb.com, jann@thejh.net, mhocko@suse.com, Konstantin Khlebnikov , vbabka@suse.cz, n-horiguchi@ah.jp.nec.com, kirill.shutemov@linux.intel.com, ldufour@linux.vnet.ibm.com, Johannes Weiner , "linux-kernel@vger.kernel.org" , Ben Zhang , Filipe Brandenburger Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 9, 2016 at 9:58 AM, Alexey Dobriyan wrote: > > On Tue, Aug 09, 2016 at 12:05:43PM -0400, robert.foss@collabora.com wrote: > > From: Sonny Rao > > > > This is based on earlier work by Thiago Goncales. It implements a new > > per process proc file which summarizes the contents of the smaps file > > but doesn't display any addresses. It gives more detailed information > > than statm like the PSS (proprotional set size). It differs from the > > original implementation in that it doesn't use the full blown set of > > seq operations, uses a different termination condition, and doesn't > > displayed "Locked" as that was broken on the original implemenation. > > > > This new proc file provides information faster than parsing the potentially > > huge smaps file. > > You can "parse" /proc/*/pagemap . RSS, swap are there. /proc/*pagemap is generally restricted and I don't believe it would quickly give PSS. > > So which ones do you really need? PSS and Swap are the most important. RSS isn't precise enough because it counts shared pages fully, and there tends to be a lot of sharing. > Why the separate anon hugepages and anon regular pages? I'm not sure if it's necessary, but that's how it's broken out in smaps. > > > + seq_printf(m, > > + "Rss: %8lu kB\n" > > + "Pss: %8lu kB\n" > > + "Shared_Clean: %8lu kB\n" > > + "Shared_Dirty: %8lu kB\n" > > + "Private_Clean: %8lu kB\n" > > + "Private_Dirty: %8lu kB\n" > > + "Referenced: %8lu kB\n" > > + "Anonymous: %8lu kB\n" > > + "AnonHugePages: %8lu kB\n" > > + "Swap: %8lu kB\n", > > + mss_sum->resident >> 10, > > + (unsigned long)(mss_sum->pss >> (10 + PSS_SHIFT)), > > + mss_sum->shared_clean >> 10, > > + mss_sum->shared_dirty >> 10, > > + mss_sum->private_clean >> 10, > > + mss_sum->private_dirty >> 10, > > + mss_sum->referenced >> 10, > > + mss_sum->anonymous >> 10, > > + mss_sum->anonymous_thp >> 10, > > + mss_sum->swap >> 10);