All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20141010132027.GB25038@gmail.com>

diff --git a/a/2.txt b/N1/2.txt
index 8b13789..4151cf7 100644
--- a/a/2.txt
+++ b/N1/2.txt
@@ -1 +1,92 @@
+>From 4e7bdd5bc22874175982ab50303eab32843c753c Mon Sep 17 00:00:00 2001
+From: Fengwei Yin <yfw.kernel@gmail.com>
+Date: Thu, 9 Oct 2014 22:20:58 +0800
+Subject: [PATCH] smaps should deal with huge zero page exactly same as normal
+ zero page.
 
+Signed-off-by: Fengwei Yin <yfw.kernel@gmail.com>
+---
+ fs/proc/task_mmu.c      | 6 ++++--
+ include/linux/huge_mm.h | 2 ++
+ mm/huge_memory.c        | 5 +++++
+ mm/memory.c             | 4 ++++
+ 4 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
+index c341568..fb19c0c 100644
+--- a/fs/proc/task_mmu.c
++++ b/fs/proc/task_mmu.c
+@@ -471,8 +471,11 @@ static void smaps_pte_entry(pte_t ptent, unsigned long addr,
+ 	if (!page)
+ 		return;
+ 
+-	if (PageAnon(page))
++	if (PageAnon(page)) {
+ 		mss->anonymous += ptent_size;
++		if (PageTransHuge(page))
++			mss->anonymous_thp += HPAGE_PMD_SIZE;
++	}
+ 
+ 	if (page->index != pgoff)
+ 		mss->nonlinear += ptent_size;
+@@ -508,7 +511,6 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
+ 	if (pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {
+ 		smaps_pte_entry(*(pte_t *)pmd, addr, HPAGE_PMD_SIZE, walk);
+ 		spin_unlock(ptl);
+-		mss->anonymous_thp += HPAGE_PMD_SIZE;
+ 		return 0;
+ 	}
+ 
+diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
+index 63579cb..9bf6263 100644
+--- a/include/linux/huge_mm.h
++++ b/include/linux/huge_mm.h
+@@ -34,6 +34,8 @@ extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
+ 			unsigned long addr, pgprot_t newprot,
+ 			int prot_numa);
+ 
++extern bool is_huge_zero_pfn(unsigned long pfn);
++
+ enum transparent_hugepage_flag {
+ 	TRANSPARENT_HUGEPAGE_FLAG,
+ 	TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c
+index f8ffd94..71ca4ed 100644
+--- a/mm/huge_memory.c
++++ b/mm/huge_memory.c
+@@ -183,6 +183,11 @@ static inline bool is_huge_zero_pmd(pmd_t pmd)
+ 	return is_huge_zero_page(pmd_page(pmd));
+ }
+ 
++inline bool is_huge_zero_pfn(unsigned long pfn)
++{
++	return is_huge_zero_page(pfn_to_page(pfn));
++}
++
+ static struct page *get_huge_zero_page(void)
+ {
+ 	struct page *zero_page;
+diff --git a/mm/memory.c b/mm/memory.c
+index e229970..5f5ecbc 100644
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -41,6 +41,7 @@
+ #include <linux/kernel_stat.h>
+ #include <linux/mm.h>
+ #include <linux/hugetlb.h>
++#include <linux/huge_mm.h>
+ #include <linux/mman.h>
+ #include <linux/swap.h>
+ #include <linux/highmem.h>
+@@ -787,6 +788,9 @@ check_pfn:
+ 		return NULL;
+ 	}
+ 
++	if (is_huge_zero_pfn(pfn))
++		return NULL;
++
+ 	/*
+ 	 * NOTE! We still have PageReserved() pages in the page tables.
+ 	 * eg. VDSO mappings can cause them to exist.
+-- 
+2.0.1
diff --git a/a/content_digest b/N1/content_digest
index 741f1af..7e4772e 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -115,5 +115,97 @@
  "\01:2\0"
  "fn\00001-smaps-should-deal-with-huge-zero-page-exactly-same-a.patch\0"
  "b\0"
+ ">From 4e7bdd5bc22874175982ab50303eab32843c753c Mon Sep 17 00:00:00 2001\n"
+ "From: Fengwei Yin <yfw.kernel@gmail.com>\n"
+ "Date: Thu, 9 Oct 2014 22:20:58 +0800\n"
+ "Subject: [PATCH] smaps should deal with huge zero page exactly same as normal\n"
+ " zero page.\n"
+ "\n"
+ "Signed-off-by: Fengwei Yin <yfw.kernel@gmail.com>\n"
+ "---\n"
+ " fs/proc/task_mmu.c      | 6 ++++--\n"
+ " include/linux/huge_mm.h | 2 ++\n"
+ " mm/huge_memory.c        | 5 +++++\n"
+ " mm/memory.c             | 4 ++++\n"
+ " 4 files changed, 15 insertions(+), 2 deletions(-)\n"
+ "\n"
+ "diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c\n"
+ "index c341568..fb19c0c 100644\n"
+ "--- a/fs/proc/task_mmu.c\n"
+ "+++ b/fs/proc/task_mmu.c\n"
+ "@@ -471,8 +471,11 @@ static void smaps_pte_entry(pte_t ptent, unsigned long addr,\n"
+ " \tif (!page)\n"
+ " \t\treturn;\n"
+ " \n"
+ "-\tif (PageAnon(page))\n"
+ "+\tif (PageAnon(page)) {\n"
+ " \t\tmss->anonymous += ptent_size;\n"
+ "+\t\tif (PageTransHuge(page))\n"
+ "+\t\t\tmss->anonymous_thp += HPAGE_PMD_SIZE;\n"
+ "+\t}\n"
+ " \n"
+ " \tif (page->index != pgoff)\n"
+ " \t\tmss->nonlinear += ptent_size;\n"
+ "@@ -508,7 +511,6 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,\n"
+ " \tif (pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {\n"
+ " \t\tsmaps_pte_entry(*(pte_t *)pmd, addr, HPAGE_PMD_SIZE, walk);\n"
+ " \t\tspin_unlock(ptl);\n"
+ "-\t\tmss->anonymous_thp += HPAGE_PMD_SIZE;\n"
+ " \t\treturn 0;\n"
+ " \t}\n"
+ " \n"
+ "diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h\n"
+ "index 63579cb..9bf6263 100644\n"
+ "--- a/include/linux/huge_mm.h\n"
+ "+++ b/include/linux/huge_mm.h\n"
+ "@@ -34,6 +34,8 @@ extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,\n"
+ " \t\t\tunsigned long addr, pgprot_t newprot,\n"
+ " \t\t\tint prot_numa);\n"
+ " \n"
+ "+extern bool is_huge_zero_pfn(unsigned long pfn);\n"
+ "+\n"
+ " enum transparent_hugepage_flag {\n"
+ " \tTRANSPARENT_HUGEPAGE_FLAG,\n"
+ " \tTRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,\n"
+ "diff --git a/mm/huge_memory.c b/mm/huge_memory.c\n"
+ "index f8ffd94..71ca4ed 100644\n"
+ "--- a/mm/huge_memory.c\n"
+ "+++ b/mm/huge_memory.c\n"
+ "@@ -183,6 +183,11 @@ static inline bool is_huge_zero_pmd(pmd_t pmd)\n"
+ " \treturn is_huge_zero_page(pmd_page(pmd));\n"
+ " }\n"
+ " \n"
+ "+inline bool is_huge_zero_pfn(unsigned long pfn)\n"
+ "+{\n"
+ "+\treturn is_huge_zero_page(pfn_to_page(pfn));\n"
+ "+}\n"
+ "+\n"
+ " static struct page *get_huge_zero_page(void)\n"
+ " {\n"
+ " \tstruct page *zero_page;\n"
+ "diff --git a/mm/memory.c b/mm/memory.c\n"
+ "index e229970..5f5ecbc 100644\n"
+ "--- a/mm/memory.c\n"
+ "+++ b/mm/memory.c\n"
+ "@@ -41,6 +41,7 @@\n"
+ " #include <linux/kernel_stat.h>\n"
+ " #include <linux/mm.h>\n"
+ " #include <linux/hugetlb.h>\n"
+ "+#include <linux/huge_mm.h>\n"
+ " #include <linux/mman.h>\n"
+ " #include <linux/swap.h>\n"
+ " #include <linux/highmem.h>\n"
+ "@@ -787,6 +788,9 @@ check_pfn:\n"
+ " \t\treturn NULL;\n"
+ " \t}\n"
+ " \n"
+ "+\tif (is_huge_zero_pfn(pfn))\n"
+ "+\t\treturn NULL;\n"
+ "+\n"
+ " \t/*\n"
+ " \t * NOTE! We still have PageReserved() pages in the page tables.\n"
+ " \t * eg. VDSO mappings can cause them to exist.\n"
+ "-- \n"
+ 2.0.1
 
-9d48946b2bd4d3cb4f6c975df8d992bbbcadf7424e9e75dcc9d72ad47b9b78e8
+4a2767728aab4a9e2f76bac001ec70768537a2a8df404bb49746d86f00c506ea

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.