Skip to content

CachedAppOptimizer: Fix FULL memcg compaction validation - #1338

Merged
neobuddy89 merged 1 commit into
crdroidandroid:16.0from
Loukious:fix/cachedappoptimizer-full-compaction
Aug 1, 2026
Merged

CachedAppOptimizer: Fix FULL memcg compaction validation#1338
neobuddy89 merged 1 commit into
crdroidandroid:16.0from
Loukious:fix/cachedappoptimizer-full-compaction

Conversation

@Loukious

@Loukious Loukious commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Compaction flags are used as a bitmask, with FILE set to 1 and ANON set to 2. FULL therefore has the value 3.

compactionFlagsValidForMemcg() uses the flags directly as an index, but its cache only has three entries, causing FULL compaction to be rejected as invalid and crash system_server.

Size the cache from the maximum valid flag combination so all valid values from NONE through FULL can be cached.

Fixes: 4ec6b89 ("CachedAppOptimizer: Fallback to process_madvise when memcg doesn't support compaction")

Compaction flags are used as a bitmask, with FILE set to 1 and
ANON set to 2. FULL therefore has the value 3.

compactionFlagsValidForMemcg() uses the flags directly as an index,
but its cache only has three entries, causing FULL compaction to be
rejected as invalid and crash system_server.

Size the cache from the maximum valid flag combination so all valid
values from NONE through FULL can be cached.

Fixes: 4ec6b89 ("CachedAppOptimizer: Fallback to process_madvise when memcg doesn't support compaction")
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.

2 participants