Re: [PATCH v4] Add /proc/PID/smaps support for DAX

From: Michal Hocko
Date: Fri Oct 27 2017 - 05:09:32 EST


On Fri 27-10-17 09:03:12, Du, Fan wrote:
[...]
> >I am not deeply familiar with DAX but I would expect that most users
> >will use a FS on top of it where we have standard tools. If the use is
> >direct then I can see how this make things more complicated but smaps is
> >not the right answer IMHO. Why? Well, just consider that you map the
> >same portions of the device multiple times for whatever reason and you
> >are screwed because you have no means to distinguish those. So you will
> >get bogus numbers. Or am I misunderstanding something?
>
> Persistent memory has two user interfaces.
> One is filesystem DAX, sitting on pmem block device, mounted with dax option to
> by pass page cache, `df` could meets my customer needs.
> The other is device DAX, where user could only mmap it to its address space,
> No file system concept. That's why we need something equivalent with `df`.
>
> Share mappings increase page mapcount, that's what PSS field for.
> It will proportionate the total size, for example the library(2MB) used by two
> processes, RSS will report 2MB plus each process own memory size,
> where PSS report the proportionally one, 2MB/2(two processes
> share the library, the page mapcount is 2) plus its own memory size.
>
> Btw, smaps is the best place to be compatible with existing online monitoring tools
> customer use now a days.

But you cannot touch rss and pss because you are going to break existing
users as Dave already pointed out. So you need something special.
Accounting page tables sounds like an interesting approach but you will
have no idea about sharing and so you are back to square one.

--
Michal Hocko
SUSE Labs