Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Aneesh Kumar K.V and committed by
Benjamin Herrenschmidt
9d85d586 88247e8d

+7 -14
+7 -14
mm/mprotect.c
··· 58 58 if (pte_numa(ptent)) 59 59 ptent = pte_mknonnuma(ptent); 60 60 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); 61 68 updated = true; 62 69 } else { 63 70 struct page *page; ··· 79 72 } 80 73 } 81 74 } 82 - 83 - /* 84 - * Avoid taking write faults for pages we know to be 85 - * dirty. 86 - */ 87 - if (dirty_accountable && pte_dirty(ptent)) { 88 - ptent = pte_mkwrite(ptent); 89 - updated = true; 90 - } 91 - 92 75 if (updated) 93 76 pages++; 94 - 95 - /* Only !prot_numa always clears the pte */ 96 - if (!prot_numa) 97 - ptep_modify_prot_commit(mm, addr, pte, ptent); 98 77 } else if (IS_ENABLED(CONFIG_MIGRATION) && !pte_file(oldpte)) { 99 78 swp_entry_t entry = pte_to_swp_entry(oldpte); 100 79