]> git.proxmox.com Git - pve-kernel.git/blob - swapops-0002-Revert-mm-ksm-convert-write_protect_page-to-use-page.patch
add mapping from DEB_BUILD_ARCH to kernel arch subdirectory
[pve-kernel.git] / swapops-0002-Revert-mm-ksm-convert-write_protect_page-to-use-page.patch
1 From 40e1fa51bc8aa3df1d3a23711b5de62d8251bff5 Mon Sep 17 00:00:00 2001
2 From: Seth Forshee <seth.forshee@canonical.com>
3 Date: Wed, 3 May 2017 08:34:52 -0500
4 Subject: [PATCH 2/4] Revert "mm, ksm: convert write_protect_page() to use
5 page_vma_mapped_walk()"
6
7 This reverts commit 3000e033152a70fa139765b4dbb5baec46b1cc1b.
8
9 Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
10 ---
11 mm/ksm.c | 34 ++++++++++++++++------------------
12 1 file changed, 16 insertions(+), 18 deletions(-)
13
14 diff --git a/mm/ksm.c b/mm/ksm.c
15 index 9dd2e58fb6dc..fed4afd8293b 100644
16 --- a/mm/ksm.c
17 +++ b/mm/ksm.c
18 @@ -856,35 +856,33 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
19 pte_t *orig_pte)
20 {
21 struct mm_struct *mm = vma->vm_mm;
22 - struct page_vma_mapped_walk pvmw = {
23 - .page = page,
24 - .vma = vma,
25 - };
26 + unsigned long addr;
27 + pte_t *ptep;
28 + spinlock_t *ptl;
29 int swapped;
30 int err = -EFAULT;
31 unsigned long mmun_start; /* For mmu_notifiers */
32 unsigned long mmun_end; /* For mmu_notifiers */
33
34 - pvmw.address = page_address_in_vma(page, vma);
35 - if (pvmw.address == -EFAULT)
36 + addr = page_address_in_vma(page, vma);
37 + if (addr == -EFAULT)
38 goto out;
39
40 BUG_ON(PageTransCompound(page));
41
42 - mmun_start = pvmw.address;
43 - mmun_end = pvmw.address + PAGE_SIZE;
44 + mmun_start = addr;
45 + mmun_end = addr + PAGE_SIZE;
46 mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
47
48 - if (!page_vma_mapped_walk(&pvmw))
49 + ptep = page_check_address(page, mm, addr, &ptl, 0);
50 + if (!ptep)
51 goto out_mn;
52 - if (WARN_ONCE(!pvmw.pte, "Unexpected PMD mapping?"))
53 - goto out_unlock;
54
55 - if (pte_write(*pvmw.pte) || pte_dirty(*pvmw.pte)) {
56 + if (pte_write(*ptep) || pte_dirty(*ptep)) {
57 pte_t entry;
58
59 swapped = PageSwapCache(page);
60 - flush_cache_page(vma, pvmw.address, page_to_pfn(page));
61 + flush_cache_page(vma, addr, page_to_pfn(page));
62 /*
63 * Ok this is tricky, when get_user_pages_fast() run it doesn't
64 * take any lock, therefore the check that we are going to make
65 @@ -894,25 +892,25 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
66 * this assure us that no O_DIRECT can happen after the check
67 * or in the middle of the check.
68 */
69 - entry = ptep_clear_flush_notify(vma, pvmw.address, pvmw.pte);
70 + entry = ptep_clear_flush_notify(vma, addr, ptep);
71 /*
72 * Check that no O_DIRECT or similar I/O is in progress on the
73 * page
74 */
75 if (page_mapcount(page) + 1 + swapped != page_count(page)) {
76 - set_pte_at(mm, pvmw.address, pvmw.pte, entry);
77 + set_pte_at(mm, addr, ptep, entry);
78 goto out_unlock;
79 }
80 if (pte_dirty(entry))
81 set_page_dirty(page);
82 entry = pte_mkclean(pte_wrprotect(entry));
83 - set_pte_at_notify(mm, pvmw.address, pvmw.pte, entry);
84 + set_pte_at_notify(mm, addr, ptep, entry);
85 }
86 - *orig_pte = *pvmw.pte;
87 + *orig_pte = *ptep;
88 err = 0;
89
90 out_unlock:
91 - page_vma_mapped_walk_done(&pvmw);
92 + pte_unmap_unlock(ptep, ptl);
93 out_mn:
94 mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
95 out:
96 --
97 2.7.4
98