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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BDE5C43334 for ; Wed, 15 Jun 2022 20:58:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C08C26B0072; Wed, 15 Jun 2022 16:58:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB8496B0074; Wed, 15 Jun 2022 16:58:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7FD66B0075; Wed, 15 Jun 2022 16:58:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 974386B0072 for ; Wed, 15 Jun 2022 16:58:05 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 5D0BE61065 for ; Wed, 15 Jun 2022 20:58:05 +0000 (UTC) X-FDA: 79581682530.15.56272CD Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf13.hostedemail.com (Postfix) with ESMTP id 8E8F220097 for ; Wed, 15 Jun 2022 20:58:04 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B4AAB8217B; Wed, 15 Jun 2022 20:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93D21C3411A; Wed, 15 Jun 2022 20:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1655326677; bh=iTyZFbAyEthLHEZJwJ5w60OvPz4a+y6uV9Z+W/TBOzQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KWaMhHUEZznBK0roFeYgsmy3jjQqaYXHTqTiKI3kqNKtVv5dhddmC2s4x5kHay4lQ NJM37klyT3xEsTZ+JfjfljDQqTQFMKQJWULWKoBOMKh5/u8d3O/dSt+C5wxnSfJng2 NAdBQqntW91ikFD+megJOZjB83AfzfHM3KnOsWd0= Date: Wed, 15 Jun 2022 13:57:56 -0700 From: Andrew Morton To: Vincent Whitchurch Cc: , , , Subject: Re: [PATCH] mm/smaps: add Pss_Dirty Message-Id: <20220615135756.ddc3341239b739d5f1f88da6@linux-foundation.org> In-Reply-To: <20220615071252.1153408-1-vincent.whitchurch@axis.com> References: <20220615071252.1153408-1-vincent.whitchurch@axis.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655326684; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QH1J7C6YcpYUn5ctqA2Jx7a+6H3KhYSyL+2rw9ShnT4=; b=xowtSW1ogMnLgtIfLodXJ4NPu56WxgvQ38cW40UXprh4LFEqFeYG1M7laj8dw/rKkgYUoC xZAtCS09ipzHfvHMBoCUq0QE3163yCCaQX2kZ5ONoqHDAqVF6yFUvoy0TAb66u0qcJeZ+h 4gHO/saq11dywUEziMADLZomkBVQpRc= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=KWaMhHUE; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655326684; a=rsa-sha256; cv=none; b=bfRlUFdaU9giZQlYiI7TcVhhWrSWR94i+ME828Q5wbwH9DmEb/yf31D1mDfuql/zcDWBi8 rPGqK402FexJVRC4admKWRhwAEd9DYMh4IAkh57kCtg1KFEZQVwpWCBRtT3yfkzs9SfFZQ RaLBqPmTg205kC1UhI/8m0biXr05oQ0= X-Stat-Signature: cgoqq9hp35a68pdcmt6dxozn7uumj87g X-Rspamd-Queue-Id: 8E8F220097 X-Rspam-User: X-Rspamd-Server: rspam05 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=KWaMhHUE; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1655326684-600367 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 Wed, 15 Jun 2022 09:12:52 +0200 Vincent Whitchurch wrote: > Pss is the sum of the sizes of clean and dirty private pages, and the > proportional sizes of clean and dirty shared pages: > > Private = Private_Dirty + Private_Clean > Shared_Proportional = Shared_Dirty_Proportional + Shared_Clean_Proportional > Pss = Private + Shared_Proportional > > The Shared*Proportional fields are not present in smaps, so it is not > possible to determine how much of the Pss is from dirty pages and how > much is from clean pages. This information can be useful for measuring > memory usage for the purpose of optimisation, since clean pages can > usually be discarded by the kernel immediately while dirty pages cannot. > > The smaps routines in the kernel already have access to this data, so > add a Pss_Dirty to show it to userspace. Pss_Clean is not added since > it can be calculated from Pss and Pss_Dirty. > > ... > > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c > @@ -406,6 +406,7 @@ struct mem_size_stats { > u64 pss_anon; > u64 pss_file; > u64 pss_shmem; > + u64 pss_dirty; > u64 pss_locked; > u64 swap_pss; > }; > @@ -427,6 +428,7 @@ static void smaps_page_accumulate(struct mem_size_stats *mss, > mss->pss_locked += pss; > > if (dirty || PageDirty(page)) { > + mss->pss_dirty += pss; > if (private) > mss->private_dirty += size; > else > @@ -820,6 +822,7 @@ static void __show_smap(struct seq_file *m, const struct mem_size_stats *mss, > SEQ_PUT_DEC(" kB\nPss_Shmem: ", > mss->pss_shmem >> PSS_SHIFT); > } > + SEQ_PUT_DEC(" kB\nPss_Dirty: ", mss->pss_dirty >> PSS_SHIFT); > SEQ_PUT_DEC(" kB\nShared_Clean: ", mss->shared_clean); > SEQ_PUT_DEC(" kB\nShared_Dirty: ", mss->shared_dirty); > SEQ_PUT_DEC(" kB\nPrivate_Clean: ", mss->private_clean); Well it's certainly simple. Can you please update Documentation/ABI/testing/procfs-smaps_rollup and Documentation/filesystems/proc.rst, resend?