Re: FAILED: patch "[PATCH] proc/pagemap: walk page tables under pte lock" failed to apply to 3.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 03/01/2015 10:28 PM, Naoya Horiguchi wrote:
On Sat, Feb 28, 2015 at 02:45:34PM -0800, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
The patch below does not apply to the 3.10-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@xxxxxxxxxxxxxxx>.
Basically a major reason of the conflict is the lack of the following patch:

   commit 81d0fa623c5b8dbd5279d9713094b0f9b0a00fb4
   Author: Peter Feiner <pfeiner@xxxxxxxxxx>
   Date:   Thu Oct 9 15:28:32 2014 -0700
mm: softdirty: unmapped addresses between VMAs are clean

but unlike for v3.14, v3.10 doesn't have soft_dirty or split pmd lock, so
we need some manual resolution to apply 81d0fa623c5b and 05fbf357d941 on
top of v3.10.70.

I think the resolution might be mainly cosmetic, but I'm not 100% sure that
the altered patches (attached) introduce no unstablity.

Peter, Konstantin, could you check attached ones and find out whether these
patches work fine on v3.10.70?  Or if there is any good reason to skip this
backporting safely, that's fine.
Sorry about sending this patch twice to some of you!

Naoya, I think those patches look fine. However, since 3.10 doesn't have softdirty, the backport of 81d0fa623c5b amounts to a bunch of cruft. I recommend applying a modified version of 05fbf357d941 on its own in order to keep the stable diff small.

Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx>
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 65fc60a..fad881b 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -903,7 +903,8 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 {
     struct vm_area_struct *vma;
     struct pagemapread *pm = walk->private;
-    pte_t *pte;
+    spinlock_t *ptl;
+    pte_t *pte, *orig_pte;
     int err = 0;
     pagemap_entry_t pme = make_pme(PM_NOT_PRESENT);

@@ -926,7 +927,9 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,

     if (pmd_trans_unstable(pmd))
         return 0;
-    for (; addr != end; addr += PAGE_SIZE) {
+
+    orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
+    for (; addr != end; addr += PAGE_SIZE, pte++) {

         /* check to see if we've left 'vma' behind
          * and need a new, higher one */
@@ -939,15 +942,13 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
          * and that it isn't a huge page vma */
         if (vma && (vma->vm_start <= addr) &&
             !is_vm_hugetlb_page(vma)) {
-            pte = pte_offset_map(pmd, addr);
             pte_to_pagemap_entry(&pme, vma, addr, *pte);
-            /* unmap before userspace copy */
-            pte_unmap(pte);
         }
         err = add_to_pagemap(addr, &pme, pm);
         if (err)
-            return err;
+            break;
     }
+    pte_unmap_unlock(orig_pte, ptl);

     cond_resched();

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]