title: How to know if a page table entry has been modified in XV6?
body: <p>I'm trying to implement On Demand paging with NRU (not recently used) algorithm.</p>
  <p>It picks a page table entry based on two factors:</p>
  <ol>
  <li>If it has been referenced recently.</li>
  <li>If it has been modified at all.</li>
  </ol>
  <p>The former can probably be set in the walkpgdir function which is what xv6 source code uses to get the page table entry for a Virtual Address.</p>
  <p>But I'm not sure how to identify if and when a Page table entry has been modified.</p>
  <p><a href="https://i.stack.imgur.com/SGRKC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SGRKC.jpg" alt="enter image description here" /></a></p>
  <p>I know that xv6 use x86 as a base and that has support for a PTE_D/dirty bit(as in the pic) which identifies if a page table entries has been modified or not. But that is not mentioned at all in the <a href="https://github.com/mit-pdos/xv6-public/blob/master/mmu.h" rel="nofollow noreferrer">xv6 source</a>.</p>