Skip to content

Commit a3a632a

Browse files
committed
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 aea4f21 commit a3a632a

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
@@ -600,9 +600,24 @@ func (c *linuxContainer) checkCriuFeatures(criuOpts *CriuOpts, rpcOpts *criurpc.
600600
logrus.Debugf("Feature check says: %s", criuFeatures)
601601
missingFeatures := false
602602

603-
if *criuFeat.MemTrack && !*criuFeatures.MemTrack {
604-
missingFeatures = true
605-
logrus.Debugf("CRIU does not support MemTrack")
603+
// The outer if checks if the fields actually exist
604+
if (criuFeat.MemTrack != nil) &&
605+
(criuFeatures.MemTrack != nil) {
606+
// The inner if checks if they are set to true
607+
if *criuFeat.MemTrack && !*criuFeatures.MemTrack {
608+
missingFeatures = true
609+
logrus.Debugf("CRIU does not support MemTrack")
610+
}
611+
}
612+
613+
// This needs to be repeated for every new feature check.
614+
// Is there a way to put this in a function. Reflection?
615+
if (criuFeat.LazyPages != nil) &&
616+
(criuFeatures.LazyPages != nil) {
617+
if *criuFeat.LazyPages && !*criuFeatures.LazyPages {
618+
missingFeatures = true
619+
logrus.Debugf("CRIU does not support LazyPages")
620+
}
606621
}
607622

608623
if missingFeatures {

0 commit comments

Comments
 (0)