futility: dump_kernel_config: Cut update check disk reads ~250x
On a nissa device, this makes the MiniOS version lookup that runs on
every update check about 250x cheaper on disk: from ~65 MB of reads
down to under 0.3 MB, with identical output.
Why: on every update check (roughly every 45 minutes), update_engine
runs dump_kernel_config on the MiniOS kernel partition to get the
MiniOS version it sends to the update server. That version sits in a
4 KB config placed after the kernel body. To get there, the tool reads
and throws away every byte in front of it through a 1 KB buffer: on
nissa, ~65 MB in ~63k read() calls per check, or roughly 1-2 GB of disk
reads per device per day.
Seek past the kernel instead of reading through it. Non-seekable
inputs such as pipes still skip by reading, and seeking past the end
of a file is rejected as before.
BUG=None
BRANCH=none
TEST=futility tests pass; verified on a nissa DUT.
Change-Id: I420aa9f34dac0c164589f33909bb34c46d4158ed
Signed-off-by: Di Wu <diwux@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/8604326
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
2 files changed