mm: save soft-dirty bits on swapped pages
Andy Lutomirski reported that if a page with _PAGE_SOFT_DIRTY bit set get swapped out, the bit is getting lost and no longer available when pte read back. To resolve this we introduce _PTE_SWP_SOFT_DIRTY bit which is saved in pte entry for the page being swapped out. When such page is to be read back from a swap cache we check for bit presence and if it's there we clear it and restore the former _PAGE_SOFT_DIRTY bit back. One of the problem was to find a place in pte entry where we can save the _PTE_SWP_SOFT_DIRTY bit while page is in swap. The _PAGE_PSE was chosen for that, it doesn't intersect with swap entry format stored in pte. Reported-by:Andy Lutomirski <luto@amacapital.net> Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Acked-by:
Pavel Emelyanov <xemul@parallels.com> Cc: Matt Mackall <mpm@selenic.com> Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Peter Zijlstra <peterz@infradead.org> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Reviewed-by:
Minchan Kim <minchan@kernel.org> Reviewed-by:
Wanpeng Li <liwanp@linux.vnet.ibm.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
Showing
- arch/x86/include/asm/pgtable.h 15 additions, 0 deletionsarch/x86/include/asm/pgtable.h
- arch/x86/include/asm/pgtable_types.h 13 additions, 0 deletionsarch/x86/include/asm/pgtable_types.h
- fs/proc/task_mmu.c 15 additions, 6 deletionsfs/proc/task_mmu.c
- include/asm-generic/pgtable.h 15 additions, 0 deletionsinclude/asm-generic/pgtable.h
- include/linux/swapops.h 2 additions, 0 deletionsinclude/linux/swapops.h
- mm/memory.c 2 additions, 0 deletionsmm/memory.c
- mm/rmap.c 5 additions, 1 deletionmm/rmap.c
- mm/swapfile.c 17 additions, 2 deletionsmm/swapfile.c
Please register or sign in to comment