linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Joel Fernandes <joel@joelfernandes.org>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com,
	riel@redhat.com, minchan@google.com, hannes@cmpxchg.org,
	kirill.shutemov@linux.intel.com
Subject: Re: rmap for shmem pages
Date: Thu, 12 Dec 2019 13:55:21 +0300	[thread overview]
Message-ID: <20191212105521.kwqn6hiudt3tbr6g@box> (raw)
In-Reply-To: <20191211235108.GA85068@google.com>

On Wed, Dec 11, 2019 at 06:51:08PM -0500, Joel Fernandes wrote:
> Hi,
> I am looking into a weird behavior of the VmRSS counter in /proc/pid/status
> which I think is a bug.
> 
> The issue is if a memfd is mapped into the same process twice as MAP_SHARED, and
> you write to both maps, then the RSS doubles even though the pages were
> mapped elsewhere within the same address space before. We expect RSS to
> increase only once in this case, not twice.

VmRSS is a best effort. Meeting your expectation would require rmap walk
(as your patch does). It's way too expensive for fault path (especially
under page table lock) just to keep percise statistics. Sorry, but you
will not get it.

-- 
 Kirill A. Shutemov


  reply	other threads:[~2019-12-12 10:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 23:51 Joel Fernandes
2019-12-12 10:55 ` Kirill A. Shutemov [this message]
2019-12-12 14:43   ` Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191212105521.kwqn6hiudt3tbr6g@box \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=joel@joelfernandes.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@google.com \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox