diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-08-21 14:44:54 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-08-21 14:44:54 +0200 |
commit | fac778a2b8d6ca953d440baeee72901c2dd5aad9 (patch) | |
tree | c43d780b5ff8819f4353b16c99601c5ceeeacad7 /mm/swapfile.c | |
parent | 07862c1cd6675cde2dd4bd64e64d704ea2185b79 (diff) | |
parent | 94fc5d9de5bd757ad46f0d94bc4ebf617c4487f6 (diff) | |
download | op-kernel-dev-fac778a2b8d6ca953d440baeee72901c2dd5aad9.zip op-kernel-dev-fac778a2b8d6ca953d440baeee72901c2dd5aad9.tar.gz |
Merge branch 'linus' into timers/core
Reason: Get upstream changes on which new patches depend on.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 36af6ee..6cf2e60 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -866,6 +866,21 @@ unsigned int count_swap_pages(int type, int free) } #endif /* CONFIG_HIBERNATION */ +static inline int maybe_same_pte(pte_t pte, pte_t swp_pte) +{ +#ifdef CONFIG_MEM_SOFT_DIRTY + /* + * When pte keeps soft dirty bit the pte generated + * from swap entry does not has it, still it's same + * pte from logical point of view. + */ + pte_t swp_pte_dirty = pte_swp_mksoft_dirty(swp_pte); + return pte_same(pte, swp_pte) || pte_same(pte, swp_pte_dirty); +#else + return pte_same(pte, swp_pte); +#endif +} + /* * No need to decide whether this PTE shares the swap entry with others, * just let do_wp_page work it out if a write is requested later - to @@ -892,7 +907,7 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, } pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); - if (unlikely(!pte_same(*pte, swp_entry_to_pte(entry)))) { + if (unlikely(!maybe_same_pte(*pte, swp_entry_to_pte(entry)))) { mem_cgroup_cancel_charge_swapin(memcg); ret = 0; goto out; @@ -947,7 +962,7 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, * swapoff spends a _lot_ of time in this loop! * Test inline before going to call unuse_pte. */ - if (unlikely(pte_same(*pte, swp_pte))) { + if (unlikely(maybe_same_pte(*pte, swp_pte))) { pte_unmap(pte); ret = unuse_pte(vma, pmd, addr, entry, page); if (ret) |