On Thu, Dec 12, 2019 at 01:55:21PM +0300, Kirill A. Shutemov wrote: > 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. No problem. I was under the same impression that this is difficult to do in a scalable way. I am glad I reached out but if anyone has any other ideas, let me know. thanks, - Joel > > -- > Kirill A. Shutemov