Skip to content

Commit 9d85d58

Browse files
kvaneeshozbenh
authored andcommitted
mm: Dirty accountable change only apply to non prot numa case
So move it within the if loop Acked-by: Mel Gorman <mgorman@suse.de> Reviewed-by: Rik van Riel <riel@redhat.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 88247e8 commit 9d85d58

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

‎mm/mprotect.c‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
5858
if (pte_numa(ptent))
5959
ptent = pte_mknonnuma(ptent);
6060
ptent = pte_modify(ptent, newprot);
61+
/*
62+
* Avoid taking write faults for pages we
63+
* know to be dirty.
64+
*/
65+
if (dirty_accountable && pte_dirty(ptent))
66+
ptent = pte_mkwrite(ptent);
67+
ptep_modify_prot_commit(mm, addr, pte, ptent);
6168
updated = true;
6269
} else {
6370
struct page *page;
@@ -72,22 +79,8 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
7279
}
7380
}
7481
}
75-
76-
/*
77-
* Avoid taking write faults for pages we know to be
78-
* dirty.
79-
*/
80-
if (dirty_accountable && pte_dirty(ptent)) {
81-
ptent = pte_mkwrite(ptent);
82-
updated = true;
83-
}
84-
8582
if (updated)
8683
pages++;
87-
88-
/* Only !prot_numa always clears the pte */
89-
if (!prot_numa)
90-
ptep_modify_prot_commit(mm, addr, pte, ptent);
9184
} else if (IS_ENABLED(CONFIG_MIGRATION) && !pte_file(oldpte)) {
9285
swp_entry_t entry = pte_to_swp_entry(oldpte);
9386

0 commit comments

Comments
 (0)