Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp858438iog; Wed, 15 Jun 2022 14:04:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uzbXXMND7NHXFKKJ75otYTmXIu8fqULAlPwDhntgkwmXxXB09vHOjxturstpQO+Z6p6Dvd X-Received: by 2002:a17:902:d0cb:b0:167:8f4d:92e6 with SMTP id n11-20020a170902d0cb00b001678f4d92e6mr1367307pln.83.1655327077009; Wed, 15 Jun 2022 14:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655327077; cv=none; d=google.com; s=arc-20160816; b=V8GDVNeRqxKLnIE+GohMs5Cd9R8q+WCa5PzEjpkFAOZ0qEH6uDI04TNqpfJZuYUbqv MmJGv2mqlyRsI6AOYkMgki2Lfpb8E2Zt/8Yqwq9hPhouXwKJ3iIOhR1A+NmNwPMVQTpM jyfJCamY3jfxSJRNRuF0Q4t/PIAw2ON1TFu5uIlvH0oUTsL3MP8Kdw0A8hqXWlpz8nc7 SRPYKNcUOaHgPvIN9Di961K18/X6wMJPENCnVOjpqYPHkXs9eQ5FowKjGRl+lTX5c4Id oFM0BAnVMPvq2WgUXOZhDtdTNr5DjelQiQpg0OH8+hUWiQLORpTP47xiOo19jKlmtMKs jU+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=QH1J7C6YcpYUn5ctqA2Jx7a+6H3KhYSyL+2rw9ShnT4=; b=XvvgikT3wQvCXDJMptmaxS4vURT/freFOWq5/FNr6AUyX37lUVhtnoaBh96TDsLeyP KhxQkvzTr777ih+MDJYgjBIKnmbVgV3lIUqNtpy9UUzcVeuJa4+AO8cgcmIKa9midaKQ OpxCR9fKMJ7XuC/mpjxzIaXfjoPMCq/UQFKSk3sD5g4sY5eeoMYhYQa8DooWeKzafJ1+ WHEbsJgkJjMnJ76YHg187Ge8MKXxaskVVgwamcRVEC1BvfE9sx2nK18SEK8Jrtdy180H hQ3Bu7aKYx0XyKixKW6QO4LRvMhwzVmuAWm9JILmdXMxTpgwQZitiroIbW9TEWWKm+KM Mr9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=KWaMhHUE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t136-20020a635f8e000000b003fc826f6ac6si78791pgb.172.2022.06.15.14.04.23; Wed, 15 Jun 2022 14:04:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=KWaMhHUE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349698AbiFOU6Q (ORCPT + 99 others); Wed, 15 Jun 2022 16:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349526AbiFOU6I (ORCPT ); Wed, 15 Jun 2022 16:58:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CF0CE29; Wed, 15 Jun 2022 13:58:00 -0700 (PDT) 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 24B46B81BEC; 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 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?