All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20150803105327.GD25034@node.dhcp.inet.fi>

diff --git a/a/1.txt b/N1/1.txt
index 837318d..003e05b 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -9,3 +9,80 @@ On Fri, Jul 31, 2015 at 05:09:38PM +0200, Jerome Marchand wrote:
 > You don't like it, do you?
 
 Urgh..
+
+>From 6c5b35ffcc425bcfc91b56d1ee404ab83cc667cf Mon Sep 17 00:00:00 2001
+From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Date: Fri, 10 Apr 2015 12:39:14 +0300
+Subject: [PATCH] thp: add option to setup migration entries during PMD split
+
+We are going to use migration PTE entries to stabilize page counts.
+If the page is mapped with PMDs we need to split the PMD and setup
+migration entries. It's reasonable to combine these operations to avoid
+double-scanning over the page table.
+
+Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Tested-by: Sasha Levin <sasha.levin@oracle.com>
+Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
+Acked-by: Vlastimil Babka <vbabka@suse.cz>
+Acked-by: Jerome Marchand <jmarchan@redhat.com>
+---
+ mm/huge_memory.c | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c
+index 1e0e02786241..0d817863a739 100644
+--- a/mm/huge_memory.c
++++ b/mm/huge_memory.c
+@@ -25,6 +25,7 @@
+ #include <linux/migrate.h>
+ #include <linux/hashtable.h>
+ #include <linux/userfaultfd_k.h>
++#include <linux/swapops.h>
+ 
+ #include <asm/tlb.h>
+ #include <asm/pgalloc.h>
+@@ -2627,7 +2628,7 @@ static void __split_huge_zero_page_pmd(struct vm_area_struct *vma,
+ }
+ 
+ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
+-               unsigned long haddr)
++               unsigned long haddr, bool freeze)
+ {
+        struct mm_struct *mm = vma->vm_mm;
+        struct page *page;
+@@ -2669,12 +2670,18 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
+                 * transferred to avoid any possibility of altering
+                 * permissions across VMAs.
+                 */
+-               entry = mk_pte(page + i, vma->vm_page_prot);
+-               entry = maybe_mkwrite(pte_mkdirty(entry), vma);
+-               if (!write)
+-                       entry = pte_wrprotect(entry);
+-               if (!young)
+-                       entry = pte_mkold(entry);
++               if (freeze) {
++                       swp_entry_t swp_entry;
++                       swp_entry = make_migration_entry(page + i, write);
++                       entry = swp_entry_to_pte(swp_entry);
++               } else {
++                       entry = mk_pte(page + i, vma->vm_page_prot);
++                       entry = maybe_mkwrite(pte_mkdirty(entry), vma);
++                       if (!write)
++                               entry = pte_wrprotect(entry);
++                       if (!young)
++                               entry = pte_mkold(entry);
++               }
+                pte = pte_offset_map(&_pmd, haddr);
+                BUG_ON(!pte_none(*pte));
+                set_pte_at(mm, haddr, pte, entry);
+@@ -2715,7 +2722,7 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
+        mmu_notifier_invalidate_range_start(mm, haddr, haddr + HPAGE_PMD_SIZE);
+        ptl = pmd_lock(mm, pmd);
+        if (likely(pmd_trans_huge(*pmd)))
+-               __split_huge_pmd_locked(vma, pmd, haddr);
++               __split_huge_pmd_locked(vma, pmd, haddr, false);
+        spin_unlock(ptl);
+        mmu_notifier_invalidate_range_end(mm, haddr, haddr + HPAGE_PMD_SIZE);
+ }
+-- 
+ Kirill A. Shutemov
diff --git a/a/content_digest b/N1/content_digest
index 5abbe6b..38fc54f 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -34,6 +34,83 @@
  "> Entries? Three different typos for three occurrences of the same word.\n"
  "> You don't like it, do you?\n"
  "\n"
- Urgh..
+ "Urgh..\n"
+ "\n"
+ ">From 6c5b35ffcc425bcfc91b56d1ee404ab83cc667cf Mon Sep 17 00:00:00 2001\n"
+ "From: \"Kirill A. Shutemov\" <kirill.shutemov@linux.intel.com>\n"
+ "Date: Fri, 10 Apr 2015 12:39:14 +0300\n"
+ "Subject: [PATCH] thp: add option to setup migration entries during PMD split\n"
+ "\n"
+ "We are going to use migration PTE entries to stabilize page counts.\n"
+ "If the page is mapped with PMDs we need to split the PMD and setup\n"
+ "migration entries. It's reasonable to combine these operations to avoid\n"
+ "double-scanning over the page table.\n"
+ "\n"
+ "Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\n"
+ "Tested-by: Sasha Levin <sasha.levin@oracle.com>\n"
+ "Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\n"
+ "Acked-by: Vlastimil Babka <vbabka@suse.cz>\n"
+ "Acked-by: Jerome Marchand <jmarchan@redhat.com>\n"
+ "---\n"
+ " mm/huge_memory.c | 23 +++++++++++++++--------\n"
+ " 1 file changed, 15 insertions(+), 8 deletions(-)\n"
+ "\n"
+ "diff --git a/mm/huge_memory.c b/mm/huge_memory.c\n"
+ "index 1e0e02786241..0d817863a739 100644\n"
+ "--- a/mm/huge_memory.c\n"
+ "+++ b/mm/huge_memory.c\n"
+ "@@ -25,6 +25,7 @@\n"
+ " #include <linux/migrate.h>\n"
+ " #include <linux/hashtable.h>\n"
+ " #include <linux/userfaultfd_k.h>\n"
+ "+#include <linux/swapops.h>\n"
+ " \n"
+ " #include <asm/tlb.h>\n"
+ " #include <asm/pgalloc.h>\n"
+ "@@ -2627,7 +2628,7 @@ static void __split_huge_zero_page_pmd(struct vm_area_struct *vma,\n"
+ " }\n"
+ " \n"
+ " static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,\n"
+ "-               unsigned long haddr)\n"
+ "+               unsigned long haddr, bool freeze)\n"
+ " {\n"
+ "        struct mm_struct *mm = vma->vm_mm;\n"
+ "        struct page *page;\n"
+ "@@ -2669,12 +2670,18 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,\n"
+ "                 * transferred to avoid any possibility of altering\n"
+ "                 * permissions across VMAs.\n"
+ "                 */\n"
+ "-               entry = mk_pte(page + i, vma->vm_page_prot);\n"
+ "-               entry = maybe_mkwrite(pte_mkdirty(entry), vma);\n"
+ "-               if (!write)\n"
+ "-                       entry = pte_wrprotect(entry);\n"
+ "-               if (!young)\n"
+ "-                       entry = pte_mkold(entry);\n"
+ "+               if (freeze) {\n"
+ "+                       swp_entry_t swp_entry;\n"
+ "+                       swp_entry = make_migration_entry(page + i, write);\n"
+ "+                       entry = swp_entry_to_pte(swp_entry);\n"
+ "+               } else {\n"
+ "+                       entry = mk_pte(page + i, vma->vm_page_prot);\n"
+ "+                       entry = maybe_mkwrite(pte_mkdirty(entry), vma);\n"
+ "+                       if (!write)\n"
+ "+                               entry = pte_wrprotect(entry);\n"
+ "+                       if (!young)\n"
+ "+                               entry = pte_mkold(entry);\n"
+ "+               }\n"
+ "                pte = pte_offset_map(&_pmd, haddr);\n"
+ "                BUG_ON(!pte_none(*pte));\n"
+ "                set_pte_at(mm, haddr, pte, entry);\n"
+ "@@ -2715,7 +2722,7 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,\n"
+ "        mmu_notifier_invalidate_range_start(mm, haddr, haddr + HPAGE_PMD_SIZE);\n"
+ "        ptl = pmd_lock(mm, pmd);\n"
+ "        if (likely(pmd_trans_huge(*pmd)))\n"
+ "-               __split_huge_pmd_locked(vma, pmd, haddr);\n"
+ "+               __split_huge_pmd_locked(vma, pmd, haddr, false);\n"
+ "        spin_unlock(ptl);\n"
+ "        mmu_notifier_invalidate_range_end(mm, haddr, haddr + HPAGE_PMD_SIZE);\n"
+ " }\n"
+ "-- \n"
+  Kirill A. Shutemov
 
-c30f304cbc5e60bb3d71509fb972e2a0eafefd91536bfb08bd7c44b2a7a13cc3
+c762f17aa7fe8497cd1a251b38d2f76a0f70111e86ac54f2b23265a487c1b72a

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.