* [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX
@ 2017-10-24 7:52 Fan Du
2017-10-24 8:46 ` Dan Williams
2017-10-24 12:01 ` Michal Hocko
0 siblings, 2 replies; 5+ messages in thread
From: Fan Du @ 2017-10-24 7:52 UTC (permalink / raw)
To: akpm, hch, dan.j.williams; +Cc: fan.du, linux-kernel
So user could check those interface for more detailed
information about how much DAX mappings are currently
created.
Here we use vma_is_dax method to find specific page
struture with DAX {huge, normal}page mappings,
vm_normal_page routine works as before without any
impact on the existing logical where _vm_normal_page
are called.
Signed-off-by: Fan Du <fan.du@intel.com>
---
fs/proc/task_mmu.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 5589b4b..ba2e58c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -528,7 +528,11 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
struct page *page = NULL;
if (pte_present(*pte)) {
- page = vm_normal_page(vma, addr, *pte);
+ if (!vma_is_dax(vma))
+ page = vm_normal_page(vma, addr, *pte);
+ else
+ page = pte_page(*pte);
+
} else if (is_swap_pte(*pte)) {
swp_entry_t swpent = pte_to_swp_entry(*pte);
@@ -579,7 +583,11 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
struct page *page;
/* FOLL_DUMP will return -EFAULT on huge zero page */
- page = follow_trans_huge_pmd(vma, addr, pmd, FOLL_DUMP);
+ if (!vma_is_dax(vma))
+ page = follow_trans_huge_pmd(vma, addr, pmd, FOLL_DUMP);
+ else
+ page = pmd_page(*pmd);
+
if (IS_ERR_OR_NULL(page))
return;
if (PageAnon(page))
@@ -1668,13 +1676,15 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
spinlock_t *ptl;
pte_t *orig_pte;
pte_t *pte;
+ struct page *page;
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
ptl = pmd_trans_huge_lock(pmd, vma);
if (ptl) {
- struct page *page;
-
- page = can_gather_numa_stats_pmd(*pmd, vma, addr);
+ if (!vma_is_dax(vma))
+ page = can_gather_numa_stats_pmd(*pmd, vma, addr);
+ else
+ page = pmd_page(*pmd);
if (page)
gather_stats(page, md, pmd_dirty(*pmd),
HPAGE_PMD_SIZE/PAGE_SIZE);
@@ -1687,7 +1697,10 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
#endif
orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
do {
- struct page *page = can_gather_numa_stats(*pte, vma, addr);
+ if (!vma_is_dax(vma))
+ page = can_gather_numa_stats(*pte, vma, addr);
+ else
+ page = pte_page(*pte);
if (!page)
continue;
gather_stats(page, md, pte_dirty(*pte), 1);
--
1.8.3.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX
2017-10-24 7:52 [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX Fan Du
@ 2017-10-24 8:46 ` Dan Williams
2017-10-24 10:25 ` Du, Fan
2017-10-24 12:01 ` Michal Hocko
1 sibling, 1 reply; 5+ messages in thread
From: Dan Williams @ 2017-10-24 8:46 UTC (permalink / raw)
To: Fan Du; +Cc: Andrew Morton, Christoph Hellwig, linux-kernel, Dave Hansen
On Tue, Oct 24, 2017 at 12:52 AM, Fan Du <fan.du@intel.com> wrote:
>
> So user could check those interface for more detailed
> information about how much DAX mappings are currently
> created.
>
> Here we use vma_is_dax method to find specific page
> struture with DAX {huge, normal}page mappings,
> vm_normal_page routine works as before without any
> impact on the existing logical where _vm_normal_page
> are called.
>
> Signed-off-by: Fan Du <fan.du@intel.com>
> ---
> fs/proc/task_mmu.c | 25 +++++++++++++++++++------
> 1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 5589b4b..ba2e58c 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -528,7 +528,11 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
> struct page *page = NULL;
>
> if (pte_present(*pte)) {
> - page = vm_normal_page(vma, addr, *pte);
> + if (!vma_is_dax(vma))
> + page = vm_normal_page(vma, addr, *pte);
> + else
> + page = pte_page(*pte);
See usage of pte_devmap, pmd_devmap, and pud_devmap in mm/gup.c. You
need to check for that bit to know that there is a 'struct page' entry
associated with a DAX mapping. I believe we just need to fix up and
resend his approach from last year:
https://marc.info/?l=linux-kernel&m=148045064103357&w=2
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX
2017-10-24 8:46 ` Dan Williams
@ 2017-10-24 10:25 ` Du, Fan
0 siblings, 0 replies; 5+ messages in thread
From: Du, Fan @ 2017-10-24 10:25 UTC (permalink / raw)
To: Williams, Dan J
Cc: Andrew Morton, Christoph Hellwig, linux-kernel, Dave Hansen, Du, Fan
>-----Original Message-----
>From: Dan Williams [mailto:dan.j.williams@intel.com]
>Sent: Tuesday, October 24, 2017 4:47 PM
>To: Du, Fan <fan.du@intel.com>
>Cc: Andrew Morton <akpm@linux-foundation.org>; Christoph Hellwig
><hch@lst.de>; linux-kernel@vger.kernel.org; Dave Hansen
><dave.hansen@linux.intel.com>
>Subject: Re: [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX
>
>On Tue, Oct 24, 2017 at 12:52 AM, Fan Du <fan.du@intel.com> wrote:
>>
>> So user could check those interface for more detailed
>> information about how much DAX mappings are currently
>> created.
>>
>> Here we use vma_is_dax method to find specific page
>> struture with DAX {huge, normal}page mappings,
>> vm_normal_page routine works as before without any
>> impact on the existing logical where _vm_normal_page
>> are called.
>>
>> Signed-off-by: Fan Du <fan.du@intel.com>
>> ---
>> fs/proc/task_mmu.c | 25 +++++++++++++++++++------
>> 1 file changed, 19 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
>> index 5589b4b..ba2e58c 100644
>> --- a/fs/proc/task_mmu.c
>> +++ b/fs/proc/task_mmu.c
>> @@ -528,7 +528,11 @@ static void smaps_pte_entry(pte_t *pte, unsigned
>long addr,
>> struct page *page = NULL;
>>
>> if (pte_present(*pte)) {
>> - page = vm_normal_page(vma, addr, *pte);
>> + if (!vma_is_dax(vma))
>> + page = vm_normal_page(vma, addr, *pte);
>> + else
>> + page = pte_page(*pte);
>
>See usage of pte_devmap, pmd_devmap, and pud_devmap in mm/gup.c. You
>need to check for that bit to know that there is a 'struct page' entry
>associated with a DAX mapping.
Thanks Dan for your review, got it!
>I believe we just need to fix up and
>resend his approach from last year:
>
> https://marc.info/?l=linux-kernel&m=148045064103357&w=2
Sure, I will rebase Dave's patch and send v2 soon.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX
2017-10-24 7:52 [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX Fan Du
2017-10-24 8:46 ` Dan Williams
@ 2017-10-24 12:01 ` Michal Hocko
2017-10-25 0:32 ` Du, Fan
1 sibling, 1 reply; 5+ messages in thread
From: Michal Hocko @ 2017-10-24 12:01 UTC (permalink / raw)
To: Fan Du; +Cc: akpm, hch, dan.j.williams, linux-kernel
On Tue 24-10-17 15:52:01, Fan Du wrote:
> So user could check those interface for more detailed
> information about how much DAX mappings are currently
> created.
>
> Here we use vma_is_dax method to find specific page
> struture with DAX {huge, normal}page mappings,
> vm_normal_page routine works as before without any
> impact on the existing logical where _vm_normal_page
> are called.
And like for any other user visible changes it should be CC to the
linux-api mailing list and a usecase which requires this information
provided as well.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX
2017-10-24 12:01 ` Michal Hocko
@ 2017-10-25 0:32 ` Du, Fan
0 siblings, 0 replies; 5+ messages in thread
From: Du, Fan @ 2017-10-25 0:32 UTC (permalink / raw)
To: Michal Hocko; +Cc: akpm, hch, Williams, Dan J, linux-kernel, Du, Fan
>-----Original Message-----
>From: Michal Hocko [mailto:mhocko@kernel.org]
>Sent: Tuesday, October 24, 2017 8:02 PM
>To: Du, Fan <fan.du@intel.com>
>Cc: akpm@linux-foundation.org; hch@lst.de; Williams, Dan J
><dan.j.williams@intel.com>; linux-kernel@vger.kernel.org
>Subject: Re: [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX
>
>On Tue 24-10-17 15:52:01, Fan Du wrote:
>> So user could check those interface for more detailed
>> information about how much DAX mappings are currently
>> created.
>>
>> Here we use vma_is_dax method to find specific page
>> struture with DAX {huge, normal}page mappings,
>> vm_normal_page routine works as before without any
>> impact on the existing logical where _vm_normal_page
>> are called.
>
>And like for any other user visible changes it should be CC to the
>linux-api mailing list and a usecase which requires this information
>provided as well.
Done!
Please kindly review v3.
>--
>Michal Hocko
>SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-25 0:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 7:52 [PATCH] Add /proc/PID/{smaps, numa_maps} support for DAX Fan Du
2017-10-24 8:46 ` Dan Williams
2017-10-24 10:25 ` Du, Fan
2017-10-24 12:01 ` Michal Hocko
2017-10-25 0:32 ` Du, Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®