Question about Page table dirty bit
I want to track the dirty memory pages between two checkpoints by using the dirty bit of the page table.
The idea is : I clear the dirty bits of the page table at the checkpoint, so the dirty pages between two checkpoints can be record by scan the dirty bits of page table at the next checkpoint. Because the hardware will set the dirty bit if there is a write to a clean memory page.
I checked the source code of kernel, "pte_mkclean"(in /include/asm-i386/pgtable.h) is the macro used to reset the dirty bit. The only place where it is used is mm/memory.c -- while initializing the ptes for a newly created process. Flushing the dirty memory pages to disk is the job of buffer cache (in fs/buffer.c), which uses page flag (include/linux/page-flags.h) to record the dirty pages.
So, it seems that it is safe to clear the dirty bit of page table. But, I do not know whether this will have some side-effect to other part of OS. So, I send this email to ask for your suggestion.
Any pointer or suggestion is highly appreciated !