aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2015-04-22 08:20:47 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-10-14 08:32:05 -0400
commita7b7617493179a0ff76cbc0cc2eb45ad07074765 (patch)
tree3e0fdcfc4aa11a5eb0115e439163187eab446ac6
parent9d49f86daba3ed22cadf01beff1b130ad25fe0bf (diff)
mm: add architecture primitives for software dirty bit clearing
There are primitives to create and query the software dirty bits in a pte or pmd. But the clearing of the software dirty bits is done in common code with x86 specific page table functions. Add the missing architecture primitives to clear the software dirty bits to allow the feature to be used on non-x86 systems, e.g. the s390 architecture. Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/x86/include/asm/pgtable.h10
-rw-r--r--fs/proc/task_mmu.c4
-rw-r--r--include/asm-generic/pgtable.h10
3 files changed, 22 insertions, 2 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 867da5bbb4a3..81e144dad405 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -318,6 +318,16 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
318 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY); 318 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);
319} 319}
320 320
321static inline pte_t pte_clear_soft_dirty(pte_t pte)
322{
323 return pte_clear_flags(pte, _PAGE_SOFT_DIRTY);
324}
325
326static inline pmd_t pmd_clear_soft_dirty(pmd_t pmd)
327{
328 return pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY);
329}
330
321#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */ 331#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
322 332
323/* 333/*
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index e2d46adb54b4..b029d426c558 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -754,7 +754,7 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma,
754 754
755 if (pte_present(ptent)) { 755 if (pte_present(ptent)) {
756 ptent = pte_wrprotect(ptent); 756 ptent = pte_wrprotect(ptent);
757 ptent = pte_clear_flags(ptent, _PAGE_SOFT_DIRTY); 757 ptent = pte_clear_soft_dirty(ptent);
758 } else if (is_swap_pte(ptent)) { 758 } else if (is_swap_pte(ptent)) {
759 ptent = pte_swp_clear_soft_dirty(ptent); 759 ptent = pte_swp_clear_soft_dirty(ptent);
760 } 760 }
@@ -768,7 +768,7 @@ static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
768 pmd_t pmd = *pmdp; 768 pmd_t pmd = *pmdp;
769 769
770 pmd = pmd_wrprotect(pmd); 770 pmd = pmd_wrprotect(pmd);
771 pmd = pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY); 771 pmd = pmd_clear_soft_dirty(pmd);
772 772
773 if (vma->vm_flags & VM_SOFTDIRTY) 773 if (vma->vm_flags & VM_SOFTDIRTY)
774 vma->vm_flags &= ~VM_SOFTDIRTY; 774 vma->vm_flags &= ~VM_SOFTDIRTY;
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 29c57b2cb344..f167cdd80fd7 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -482,6 +482,16 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
482 return pmd; 482 return pmd;
483} 483}
484 484
485static inline pte_t pte_clear_soft_dirty(pte_t pte)
486{
487 return pte;
488}
489
490static inline pmd_t pmd_clear_soft_dirty(pmd_t pmd)
491{
492 return pmd;
493}
494
485static inline pte_t pte_swp_mksoft_dirty(pte_t pte) 495static inline pte_t pte_swp_mksoft_dirty(pte_t pte)
486{ 496{
487 return pte; 497 return pte;