Hey I'm just curious...how do you detect if a memory page mapped by a page table has been written to or accessed?

I imagine if you're writing a filesystem task, such information would help you know when to flush data back to disk or which pages to keep around if things get tight.

I hope this isn't a stupid question.