File dirty.cpp
-
namespace faabric
-
namespace util
Functions
-
std::shared_ptr<DirtyTracker> getDirtyTracker()
Returns the dirty tracker singleton. The dirty tracking mode is determined in the system config.
-
void resetDirtyTracker()
Resets the dirty tracker singleton (e.g. if the config has been changed).
-
void *pageAlignAddress(void *faultAddr)
Variables
-
static thread_local DirtyTrackingRecord tracking
-
static ThreadSafeDirtyTrackingRecord globalTracking
-
static std::shared_ptr<DirtyTracker> tracker = nullptr
-
static long uffd = -1
-
static bool uffdWriteProtect = false
-
static bool uffdSigbus = false
-
static int closeFd = -1
-
static std::shared_ptr<std::jthread> eventThread = nullptr
-
class DirtyTrackingRecord
Wrapper around the actual bookkeeping behind dirty tracking. This is deliberately not thread-safe as it will only ever be used in TLS for signal handlers.
Subclassed by faabric::util::ThreadSafeDirtyTrackingRecord
Public Functions
-
DirtyTrackingRecord() = default
-
inline virtual void trackRegion(std::span<uint8_t> region)
-
inline virtual void markPage(void *addr)
-
inline virtual bool isInitialised()
-
inline virtual int getNPages()
-
inline virtual std::vector<char> getDirtyFlags()
-
inline virtual void reset()
-
DirtyTrackingRecord() = default
-
class ThreadSafeDirtyTrackingRecord : public faabric::util::DirtyTrackingRecord
Thread-safe wrapper around dirty tracking data, necessary for use with the background event thread in the userfaultfd tracker. Although the logic around the interaction between the event thread and the main thread should in theory protect against concurrent accesses, we need this to keep TSan happy.
Public Functions
-
ThreadSafeDirtyTrackingRecord() = default
-
inline virtual void trackRegion(std::span<uint8_t> region) override
-
inline virtual void markPage(void *addr) override
-
inline virtual std::vector<char> getDirtyFlags() override
-
inline virtual bool isInitialised() override
-
inline virtual int getNPages() override
-
inline virtual void reset() override
Private Members
-
std::shared_mutex mx
-
ThreadSafeDirtyTrackingRecord() = default
-
std::shared_ptr<DirtyTracker> getDirtyTracker()
-
namespace util