Skip to content

Commit cc2a497

Browse files
adrianreberstefanberger
authored andcommitted
checkpoint: add support to query for lazy page support
Before adding the actual lazy migration support, this adds the feature check for lazy-pages. Right now lazy migration, which is based on userfaultd is only available in the criu-dev branch and not yet in a release. As the check does not dependent on a certain version but on a CRIU feature which can be queried it can be part of runC without a new version check depending on a feature from criu-dev. Signed-off-by: Adrian Reber <[email protected]>
1 parent 9352e20 commit cc2a497

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

libcontainer/container_linux.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,24 @@ func (c *linuxContainer) checkCriuFeatures(criuOpts *CriuOpts, rpcOpts *criurpc.
621621
logrus.Debugf("Feature check says: %s", criuFeatures)
622622
missingFeatures := false
623623

624-
if *criuFeat.MemTrack && !*criuFeatures.MemTrack {
625-
missingFeatures = true
626-
logrus.Debugf("CRIU does not support MemTrack")
624+
// The outer if checks if the fields actually exist
625+
if (criuFeat.MemTrack != nil) &&
626+
(criuFeatures.MemTrack != nil) {
627+
// The inner if checks if they are set to true
628+
if *criuFeat.MemTrack && !*criuFeatures.MemTrack {
629+
missingFeatures = true
630+
logrus.Debugf("CRIU does not support MemTrack")
631+
}
632+
}
633+
634+
// This needs to be repeated for every new feature check.
635+
// Is there a way to put this in a function. Reflection?
636+
if (criuFeat.LazyPages != nil) &&
637+
(criuFeatures.LazyPages != nil) {
638+
if *criuFeat.LazyPages && !*criuFeatures.LazyPages {
639+
missingFeatures = true
640+
logrus.Debugf("CRIU does not support LazyPages")
641+
}
627642
}
628643

629644
if missingFeatures {

0 commit comments

Comments
 (0)