Welcome to the Linux Foundation Forum!

Localized clearing of SOFT_DIRTY bits on pages?

Hi, first time posting here, so hope this is the right location.

I have been working with pagemap APIs for dirty-page tracking. Right now, it looks like there are two options to do this:

  1. PAGEMAP_SCAN with uffd memory: This seems to be the most optimal, and allows for re-protecting just the pages that we written. However, without diving into too many reasons, using uffd memory will be infeasible for our use-case.

  2. Soft Dirty bit tracking: This seems more promising. However it seems like there only exist a global clear to soft dirty bits (by writing "4" to /proc/self/clearrefs). This tends to be a problem since we are a library that we hope to embed in other larger processes that might want to use soft dirty bits themselves. Is there a way to only way to clear soft dirty bits on a specific range of memory?

Essentially the design point I'm looking for is a way to do dirty-page tracking on a range of memory without relying on UFFD.

Thanks!

Categories

Upcoming Training