Skip to content

assemble_cvd: avoid repeated sparse super conversions - #3334

Open
zhangxp1998 wants to merge 1 commit into
google:mainfrom
zhangxp1998:optimize-super-repack
Open

zhangxp1998 wants to merge 1 commit into
google:mainfrom
zhangxp1998:optimize-super-repack

Conversation

@zhangxp1998

Copy link
Copy Markdown
Contributor

Summary

  • materialize a sparse build super.img directly as the per-instance raw image before replacing DLKM partitions
  • preserve the per-instance raw super.img across resume when the base OS inputs are unchanged
  • publish a newly converted image via a temporary file and atomic rename

Why

The previous repack flow copied the sparse build image and invoked lpadd twice. Each invocation converted the full super image to raw and back to sparse, after which assemble_cvd converted it to raw once more. Resume also deleted the resulting per-instance raw image and repeated this work.

Creating the per-instance raw image first lets both lpadd --replace calls operate in place. Keeping that image on resume avoids the initial conversion on subsequent kernel/ramdisk repacks. Existing OS-input invalidation still decides when the preserved image is unsafe to reuse.

Validation

  • bazel build //cuttlefish/host/commands/assemble_cvd:assemble_cvd
  • local end-to-end A/B using the same 8 GiB sparse super and two DLKM replacement images:
    • previous flow: 10.126 s
    • direct-raw flow: 0.649 s (15.6x faster)
    • final 8 GiB raw images are byte-for-byte identical
    • allocated blocks decreased from 16,777,232 to 3,268,416

@zhangxp1998
zhangxp1998 force-pushed the optimize-super-repack branch from 22b4429 to dc206b7 Compare October 10, 2026 04:47
When repacking DLKM partitions, convert a sparse build super image directly into the per-instance raw image first. Both lpadd operations can then update that image in place instead of repeatedly converting the full super image between sparse and raw formats.
@zhangxp1998
zhangxp1998 force-pushed the optimize-super-repack branch 2 times, most recently from 3b2d934 to 9659cd0 Compare October 10, 2026 09:04

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant