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