reusable_build: improve ccahe handling#94
Merged
hauke merged 3 commits intoopenwrt:mainfrom Apr 12, 2026
Merged
Conversation
hauke
commented
Apr 11, 2026
|
|
||
| echo compiler_type=gcc >> $SYSTEM_CCACHE_CONF | ||
| [ ${{ inputs.ccache_type }} = 'kernel' ] && echo max_size=400M >> $SYSTEM_CCACHE_CONF | ||
| [ ${{ inputs.ccache_type }} = 'kernel' ] && echo max_size=800M >> $SYSTEM_CCACHE_CONF |
Member
Author
There was a problem hiding this comment.
@Ansuel Do you have enough storage for this change?
Member
Author
|
This is untested, how do I test this? I was running the build in a local container in a similar way like the CI does it. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Add a step to print the ccache hit rate, miss rate, and cache size after each build. This makes it easy to verify that the cache is being populated and used correctly. Link: openwrt#94 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The previous limit of 400M was too small to hold a complete kernel
build. A cold build of kernel 6.12 for ipq40xx/generic fills the
cache to 659M, which means ccache was evicting entries mid-build.
Those evicted entries would then be cache misses on the next build,
reducing the hit rate and defeating the purpose of the cache. Increase
the limit to 800M to fit a full kernel build and maximize hits on
subsequent builds.
Measured cache usage after a cold kernel 6.12 build for ipq40xx/generic:
```
buildbot@013d604d7d26:/openwrt$ du -sh .ccache/
659M .ccache/
buildbot@013d604d7d26:/openwrt$ CCACHE_DIR=.ccache staging_dir/host/bin/ccache --show-stats
Cacheable calls: 5842 / 5955 (98.10%)
Hits: 43 / 5842 ( 0.74%)
Direct: 43 / 43 (100.0%)
Preprocessed: 0 / 43 ( 0.00%)
Misses: 5799 / 5842 (99.26%)
Uncacheable calls: 113 / 5955 ( 1.90%)
Local storage:
Cache size (GiB): 0.6 / 5.0 (12.82%)
Hits: 43 / 5842 ( 0.74%)
Misses: 5799 / 5842 (99.26%)
```
Link: openwrt#94
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
When upload_ccache_cache is enabled, skip restoring the existing cache from S3 and GitHub Actions before building. This ensures the uploaded cache only contains entries from the current build, without accumulating stale entries from previous builds that may no longer be relevant (e.g. after a kernel version bump). A smaller, fresher cache is faster to download and more effective than a large cache polluted with obsolete entries. Skip it only for kernel builds, because this would reduce the speed of all package builds too much. Link: openwrt#94 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reusable_build: show ccache statistics after build
Add a step to print the ccache hit rate, miss rate, and cache size
after each build. This makes it easy to verify that the cache is
being populated and used correctly.
reusable_build: increase kernel ccache size limit to 800M
The previous limit of 400M was too small to hold a complete kernel
build. A cold build of kernel 6.12 for ipq40xx/generic fills the
cache to 659M, which means ccache was evicting entries mid-build.
Those evicted entries would then be cache misses on the next build,
reducing the hit rate and defeating the purpose of the cache. Increase
the limit to 800M to fit a full kernel build and maximize hits on
subsequent builds.
Measured cache usage after a cold kernel 6.12 build for ipq40xx/generic:
reusable_build: use fresh ccache when upload_ccache_cache is set
When upload_ccache_cache is enabled, skip restoring the existing cache
from S3 and GitHub Actions before building. This ensures the uploaded
cache only contains entries from the current build, without
accumulating stale entries from previous builds that may no longer be
relevant (e.g. after a kernel version bump). A smaller, fresher cache
is faster to download and more effective than a large cache polluted
with obsolete entries.