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

From: Du, Fan
Date: Fri Oct 27 2017 - 05:17:17 EST




>-----Original Message-----
>From: Michal Hocko [mailto:mhocko@xxxxxxxxxx]
>Sent: Friday, October 27, 2017 5:09 PM
>To: Du, Fan <fan.du@xxxxxxxxx>
>Cc: Hansen, Dave <dave.hansen@xxxxxxxxx>; akpm@xxxxxxxxxxxxxxxxxxxx;
>hch@xxxxxx; Williams, Dan J <dan.j.williams@xxxxxxxxx>;
>linux-kernel@xxxxxxxxxxxxxxx
>Subject: Re: [PATCH v4] Add /proc/PID/smaps support for DAX
>
>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.

Why it will break something? Do you mind to elaborate?
The vma part of each smaps portion has associated file if does exist,
The user spaces monitoring tools will definitely check this field.

>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