From: Fan Du <fan.du@intel.com>
To: akpm@linux-foundation.org, hch@lst.de, dan.j.williams@intel.com,
dave.hansen@intel.com, mhocko@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
Fan Du <fan.du@intel.com>
Subject: [PATCH 2/2] Add /proc/PID/{smaps, numa_maps} support for DAX
Date: Wed, 25 Oct 2017 08:27:35 +0800 [thread overview]
Message-ID: <1508891255-15427-2-git-send-email-fan.du@intel.com> (raw)
In-Reply-To: <1508891255-15427-1-git-send-email-fan.du@intel.com>
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.
With this patch, user could check Device DAX usage at Ptes@ readings,
fox example, statistics from a Device DAX algined by 2MB:
7f6c17800000-7f6c17e00000 rw-s 00000000 00:06 20559 /dev/dax12.0
Size: 6144 kB
.
.
.
Ptes@2MB: 6144 kB
Signed-off-by: Fan Du <fan.du@intel.com>
---
v3:
* Elaborate more about the usage suggested by Michal Hocko
v2:
* Using pte_devmap to check valid pfn page structure,
Pointed out by Dan. thx!
---
fs/proc/task_mmu.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 30dbf37..5c4535c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -531,7 +531,10 @@ 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 if (pte_devmap(*pte))
+ page = pte_page(*pte);
mss->rss_pte += PAGE_SIZE;
} else if (is_swap_pte(*pte)) {
swp_entry_t swpent = pte_to_swp_entry(*pte);
@@ -583,7 +586,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 if (pmd_devmap(*pmd))
+ page = pmd_page(*pmd);
+
if (IS_ERR_OR_NULL(page))
return;
if (PageAnon(page))
@@ -1770,13 +1777,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 if (pmd_devmap(*pmd))
+ page = pmd_page(*pmd);
if (page)
gather_stats(page, md, pmd_dirty(*pmd),
HPAGE_PMD_SIZE/PAGE_SIZE);
@@ -1789,7 +1798,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 if (pte_devmap(*pte))
+ page = pte_page(*pte);
if (!page)
continue;
gather_stats(page, md, pte_dirty(*pte), 1);
--
1.8.3.1
next prev parent reply other threads:[~2017-10-25 0:29 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 0:27 [PATCHv3 1/2] proc: mm: export PTE sizes directly in smaps Fan Du
2017-10-25 0:27 ` Fan Du [this message]
2017-10-25 9:30 ` [PATCH 2/2] Add /proc/PID/{smaps, numa_maps} support for DAX Michal Hocko
2017-10-25 17:14 ` Dave Hansen
2017-10-26 14:16 ` Michal Hocko
2017-10-26 14:24 ` Dave Hansen
2017-10-26 14:31 ` Michal Hocko
2017-10-26 14:51 ` Dave Hansen
2017-10-26 15:07 ` Michal Hocko
2017-10-26 15:56 ` Dan Williams
2017-10-27 4:00 ` Du, Fan
2017-10-27 10:31 ` Dan Williams
2017-10-28 2:07 ` kbuild test robot
2017-10-25 9:28 ` [PATCHv3 1/2] proc: mm: export PTE sizes directly in smaps Michal Hocko
2017-10-26 1:41 ` Du, Fan
2017-10-26 5:13 ` [PATCH v4] Add /proc/PID/smaps support for DAX Fan Du
2017-10-26 9:16 ` Dan Williams
2017-10-27 2:49 ` Du, Fan
2017-10-26 14:03 ` Dave Hansen
2017-10-27 2:47 ` Du, Fan
2017-10-27 8:07 ` Michal Hocko
2017-10-27 8:24 ` Du, Fan
2017-10-27 8:42 ` Michal Hocko
2017-10-27 9:03 ` Du, Fan
2017-10-27 9:09 ` Michal Hocko
2017-10-27 9:17 ` Du, Fan
2017-10-27 9:26 ` Michal Hocko
2017-10-27 9:34 ` Du, Fan
2017-10-26 14:19 ` [PATCHv3 1/2] proc: mm: export PTE sizes directly in smaps Michal Hocko
2017-10-26 14:25 ` Dave Hansen
2017-10-29 14:19 ` [lkp-robot] [proc] eb948c71f7: WARNING:at_mm/hugetlb.c:#hugetlb_add_hstate kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508891255-15427-2-git-send-email-fan.du@intel.com \
--to=fan.du@intel.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=hch@lst.de \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®