Skip to content

Commit f310273

Browse files
committed
chore(uffd): fix stale comment and minor cleanups
- userfaultfd.go: correct the `case faulted` branch comment to refer to the `removed` page state (previously claimed REMOVE marks the page as `missing`) and drop the duplicated "a a" typo. - userfaultfd.go: restore the colon in the "failed uffdio copy: %w" error message that was lost when faultPage was refactored to return (bool, error). - fcversion: simplify HasFreePageReporting to a single boolean return.
1 parent c8b3d63 commit f310273

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

packages/orchestrator/pkg/sandbox/uffd/userfaultfd/userfaultfd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ func (u *Userfaultfd) Serve(
317317
case faulted:
318318
// Skip faulting the page. This has already been faulted, either during pre-faulting
319319
// or because we handled another page fault on the same address in the current
320-
// iteration. It can only be removed via a a UFFD_EVENT_REMOVE, which will mark the
321-
// page as `missing`.
320+
// iteration. It can only transition out of `faulted` via a UFFD_EVENT_REMOVE, which
321+
// will mark the page as `removed`.
322322
// For this to work correctly, the used pages cannot be swappable.
323323
continue
324324
case removed:
@@ -512,7 +512,7 @@ func (u *Userfaultfd) faultPage(
512512
span.RecordError(joinedErr)
513513
u.logger.Error(ctx, "UFFD serve uffdio copy error", zap.Error(joinedErr))
514514

515-
return false, fmt.Errorf("failed uffdio copy %w", joinedErr)
515+
return false, fmt.Errorf("failed uffdio copy: %w", joinedErr)
516516
}
517517

518518
return true, nil

packages/shared/pkg/fcversion/sandbox_features.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,5 @@ func (v *Info) HasHugePages() bool {
99
}
1010

1111
func (v *Info) HasFreePageReporting() bool {
12-
if v.lastReleaseVersion.Major() > 1 || (v.lastReleaseVersion.Major() == 1 && v.lastReleaseVersion.Minor() >= 14) {
13-
return true
14-
}
15-
16-
return false
12+
return v.lastReleaseVersion.Major() > 1 || (v.lastReleaseVersion.Major() == 1 && v.lastReleaseVersion.Minor() >= 14)
1713
}

0 commit comments

Comments
 (0)