path: root/mm/msync.c
diff options
authorAbhijit Karmarkar <>2005-06-21 17:15:13 -0700
committerLinus Torvalds <>2005-06-21 18:46:21 -0700
commitb4955ce3dd0818b56da532a16c9a4a3804a558ee (patch)
tree6e01667181bfc495b56e39748783ad2235a4f56e /mm/msync.c
parentc475a8ab625d567eacf5e30ec35d6d8704558062 (diff)
[PATCH] msync: check pte dirty earlier
It's common practice to msync a large address range regularly, in which often only a few ptes have actually been dirtied since the previous pass. sync_pte_range then goes much faster if it tests whether pte is dirty before locating and accessing each struct page cacheline; and it is hardly slowed by ptep_clear_flush_dirty repeating that test in the opposite case, when every pte actually is dirty. But beware, s390's pte_dirty always says false, since its dirty bit is kept in the storage key, located via the struct page address. So skip this optimization in its case: use a pte_maybe_dirty macro which just says true if page_test_and_clear_dirty is implemented. Signed-off-by: Abhijit Karmarkar <> Signed-off-by: Hugh Dickins <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/msync.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/msync.c b/mm/msync.c
index 090f426bca7d..d0f5a1bce7cb 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -34,6 +34,8 @@ static void sync_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
if (!pte_present(*pte))
+ if (!pte_maybe_dirty(*pte))
+ continue;
pfn = pte_pfn(*pte);
if (!pfn_valid(pfn))