kernel-ark/Documentation/vm
Pavel Emelyanov 0f8975ec4d mm: soft-dirty bits for user memory changes tracking
The soft-dirty is a bit on a PTE which helps to track which pages a task
writes to.  In order to do this tracking one should

  1. Clear soft-dirty bits from PTEs ("echo 4 > /proc/PID/clear_refs)
  2. Wait some time.
  3. Read soft-dirty bits (55'th in /proc/PID/pagemap2 entries)

To do this tracking, the writable bit is cleared from PTEs when the
soft-dirty bit is.  Thus, after this, when the task tries to modify a
page at some virtual address the #PF occurs and the kernel sets the
soft-dirty bit on the respective PTE.

Note, that although all the task's address space is marked as r/o after
the soft-dirty bits clear, the #PF-s that occur after that are processed
fast.  This is so, since the pages are still mapped to physical memory,
and thus all the kernel does is finds this fact out and puts back
writable, dirty and soft-dirty bits on the PTE.

Another thing to note, is that when mremap moves PTEs they are marked
with soft-dirty as well, since from the user perspective mremap modifies
the virtual memory at mremap's new address.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03 16:07:26 -07:00
..
.gitignore
00-INDEX slub: doc: update the slabinfo.c file path 2011-08-31 20:10:17 +03:00
active_mm.txt Fix common misspellings 2011-03-31 11:26:23 -03:00
balance
cleancache.txt Cleanups: rename of flush to invalidate, moving reporting of statistics 2012-03-22 19:52:47 -07:00
frontswap.txt doc: fix quite a few typos within Documentation 2012-11-19 14:28:24 +01:00
highmem.txt
hugetlbpage.txt hugetlb: update hugetlbpage.txt 2012-08-21 16:45:03 -07:00
hwpoison.txt Documentation: update cgroupfs mount point 2011-06-15 21:52:50 -07:00
ksm.txt ksm: add some comments 2013-02-23 17:50:23 -08:00
locking mm: Convert i_mmap_lock to a mutex 2011-05-25 08:39:18 -07:00
numa doc: fix broken references 2011-09-27 18:08:04 +02:00
numa_memory_policy.txt
overcommit-accounting mm: limit growth of 3% hardcoded other user reserve 2013-04-29 15:54:36 -07:00
page_migration
pagemap.txt proc: report file/anon bit in /proc/pid/pagemap 2012-05-31 17:49:29 -07:00
slub.txt Documentations: Fix slabinfo.c directory in vm/slub.txt 2012-05-10 11:45:23 +03:00
soft-dirty.txt mm: soft-dirty bits for user memory changes tracking 2013-07-03 16:07:26 -07:00
transhuge.txt thp: introduce sysfs knob to disable huge zero page 2012-12-12 17:38:32 -08:00
unevictable-lru.txt mm: remove vma arg from page_evictable 2012-10-09 16:22:55 +09:00