Skip to contentSkip to conversation

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

DISCUSSION [email protected] 1 participant 1 message Apr 26, 2015 3 messages not in the archive Stable branch

lore
Share & tools
lore

[email protected]

author maintainer
#3 lore raw
In reply to a message not in the archive
Quoted 67 lines · Peter Feiner
Quoted 16 lines · Naoya Horiguchi
Quoted 4 lines · On Sat, Feb 28, 2015 at 02:45:34PM -0800, [email protected] 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 <[email protected]>.

Basically a major reason of the conflict is the lack of the following patch:

commit 81d0fa623c5b8dbd5279d9713094b0f9b0a00fb4
Author: Peter Feiner <[email protected]>
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.

Quoted 6 lines

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.

fs/proc/task_mmu.c +5 -2
index 65fc60a..fad881b 100644
@@ -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 */

fs/proc/task_mmu.c +0 -2
@@ -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 */

fs/proc/task_mmu.c static int pagemap_pte_range(pmd_t *pmd, unsigned long · line 954

Quoted 10 lines
fs/proc/task_mmu.c +2 -2
-            pte_unmap(pte);
         }
         err = add_to_pagemap(addr, &pme, pm);
         if (err)
-            return err;
+            break;
     }
+    pte_unmap_unlock(orig_pte, ptl);
 
     cond_resched();

Naoya, can you resend these in a format that I can apply them in, after you are able to test them, if you want them in the older kernel releases.

thanks,

greg k-h