Reintroduce incremental checkpointing - #125
Open
alessandropellegrini wants to merge 5 commits into
Open
Conversation
This commit reintroduces support for incremental checkpointing. Rather than basing it on the '09 DyMeLoR implementation, it is now based on the buddy system that is backing LP allocation. There's no support for instrumentation, in line with the "core" approach: if incremental checkpointing is enabled but no __write_mem() calls are placed in the code, it's undefined behaviour and nothing will work. There are some aspects to document related to the different checkpointing schemes we currently support. None of these are correctness issues, but are rather performance corner cases that should be documented. # Interaction with autonomic checkpointing When both incremental_ckpt = true and ckpt_interval = 0 (autonomic mode), the autonomic formula uses checkpoint cost statistics that mix full and incremental checkpoints, leading to a biased estimate of the optimal interval. A lower ckpt_avg_cost causes the current autonomic formula to compute a shorter optimal checkpoint interval (more frequent checkpoints). This is arguably desirable: incremental checkpoints should be cheap (although model dependent), so taking them more often should be efficient. However, the model is imprecise: it treats the mix of full and incremental checkpoints as if they were a homogeneous cost, when in reality every full_ckpt_period-th checkpoint has a significantly higher cost. This is am ok-ish side effect. The autonomic mechanism will converge to a workable interval. The bias is in the "correct" direction (more frequent checkpointing when checkpoints are cheap). A more precise model would account for the amortized cost of the periodic full checkpoint, but this is an optimization, not a correctness issue. # Fossil collection When incremental checkpointing is active, model_allocator_fossil_lp_collect walks backward from the fossil collection target until it finds a full checkpoint. It retains that full checkpoint (and all incremental checkpoints after it) because the incremental chain needs its base. If full_ckpt_period is large (e.g., 100), and the autonomic mechanism selects a short ckpt_interval (e.g., 5), then between two full checkpoints there are up to 99 incremental checkpoints. Fossil collection cannot free ANY of them until the next full checkpoint is committed. This creates a memory sawtooth: checkpoint memory grows during the incremental chain and is only reclaimed in bulk when the full checkpoint falls behind the GVT. Users should be aware that full_ckpt_period controls the maximum length of the non-reclaimable checkpoint chain. A very high value increases peak memory usage. I'll try to document this in the upcoming months (years?). # Behaviour on frequent rollbacks If an LP experiences frequent rollbacks, ckpt_since_last_full may never reach full_ckpt_period. This means full checkpoints are taken less often than the configured period, prolonging the incremental chain and delaying its release by fossil collection. The autonomic mechanism registers each rollback as a bad event, which increases the rollback probability estimate and shortens the checkpoint interval. More frequent checkpoints + infrequent full checkpoints = a long chain of incremental checkpoints that cannot be fossil-collected. In practice, LPs experiencing many rollbacks will eventually advance past a GVT boundary and receive a full checkpoint. But the worst case (high rollback rate + high full_ckpt_period + short autonomic interval) could lead to unexpectedly high memory consumption from checkpoint storage. Signed-off-by: Alessandro Pellegrini <a.pellegrini@ing.uniroma2.it>
alessandropellegrini
requested review from
Piccions
and removed request for
Piccions
June 11, 2026 16:32
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #125 +/- ##
===========================================
+ Coverage 85.51% 89.60% +4.08%
===========================================
Files 46 49 +3
Lines 1553 2308 +755
Branches 39 40 +1
===========================================
+ Hits 1328 2068 +740
- Misses 209 223 +14
- Partials 16 17 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Piccions
reviewed
Jun 11, 2026
Piccions
left a comment
Contributor
There was a problem hiding this comment.
Some issues to fix, but otherwise looks good!
Fixes in this commit: - Properly initialize the last_dirty pointer - Model allocator functions that write to the state now update the dirty bitmap - Incremental ckpt size is properly computed/used Signed-off-by: Alessandro Pellegrini <a.pellegrini@ing.uniroma2.it>
Member
Author
|
I should have addressed all the issues. One of them motivated me to write additional tests, so I'll push later once I'm done. |
Multiple new tests have been introduced, to test more thoroughly the implementation of the memory management subsystem. Signed-off-by: Alessandro Pellegrini <a.pellegrini@ing.uniroma2.it>
Since we are dropping the intrumentation support, WriteMemory becomes and actual library call that is exported. Signed-off-by: Alessandro Pellegrini <a.pellegrini@ing.uniroma2.it>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR reintroduces support for incremental checkpointing. Rather than basing it on the '09 DyMeLoR implementation, it is now based on the buddy system that is backing LP allocation.
There's no support for instrumentation, in line with the "core" approach: if incremental checkpointing is enabled but no __write_mem() calls are placed in the code, it's undefined behaviour and nothing will work.
There are some aspects to document related to the different checkpointing schemes we currently support. None of these are correctness issues, but are rather performance corner cases that should be documented.
Interaction with autonomic checkpointing
When both incremental_ckpt = true and ckpt_interval = 0 (autonomic mode), the autonomic formula uses checkpoint cost statistics that mix full and incremental checkpoints, leading to a biased estimate of the optimal interval.
A lower ckpt_avg_cost causes the current autonomic formula to compute a shorter optimal checkpoint interval (more frequent checkpoints). This is arguably desirable: incremental checkpoints should be cheap (although model dependent), so taking them more often should be efficient.
However, the model is imprecise: it treats the mix of full and incremental checkpoints as if they were a homogeneous cost, when in reality every full_ckpt_period-th checkpoint has a significantly higher cost.
This is am ok-ish side effect. The autonomic mechanism will converge to a workable interval. The bias is in the "correct" direction (more frequent checkpointing when checkpoints are cheap). A more precise model would account for the amortized cost of the periodic full checkpoint, but this is an optimization, not a correctness issue.
Fossil collection
When incremental checkpointing is active, model_allocator_fossil_lp_collect walks backward from the fossil collection target until it finds a full checkpoint. It retains that full checkpoint (and all incremental checkpoints after it) because the incremental chain needs its base.
If full_ckpt_period is large (e.g., 100), and the autonomic mechanism selects a short ckpt_interval (e.g., 5), then between two full checkpoints there are up to 99 incremental checkpoints. Fossil collection cannot free ANY of them until the next full checkpoint is committed. This creates a memory sawtooth: checkpoint memory grows during the incremental chain and is only reclaimed in bulk when the full checkpoint falls behind the GVT.
Users should be aware that full_ckpt_period controls the maximum length of the non-reclaimable checkpoint chain. A very high value increases peak memory usage. I'll try to document this in the upcoming months (years?).
Behaviour on frequent rollbacks
If an LP experiences frequent rollbacks, ckpt_since_last_full may never reach full_ckpt_period. This means full checkpoints are taken less often than the configured period, prolonging the incremental chain and delaying its release by fossil collection.
The autonomic mechanism registers each rollback as a bad event, which increases the rollback probability estimate and shortens the checkpoint interval. More frequent checkpoints + infrequent full checkpoints = a long chain of incremental checkpoints that cannot be fossil-collected.
In practice, LPs experiencing many rollbacks will eventually advance past a GVT boundary and receive a full checkpoint. But the worst case (high rollback rate + high full_ckpt_period