Repository navigation
kernel: keep K_HEAP_MEM_POOL_SIZE defined when Gale replaces mempool.c (gale#401) - #1
Merged
Conversation
This was referenced Sep 17, 2026
The Gale patch skipped the whole CONFIG_KERNEL_MEM_POOL block when CONFIG_GALE_KERNEL_MEMPOOL=y. That block does two things: adds mempool.c, and defines K_HEAP_MEM_POOL_SIZE for the whole build, the only place it is defined. gale_mempool.c defines k_malloc (and k_calloc, k_realloc, k_aligned_alloc, k_thread_system_pool_assign) only under it, while kernel.h declares k_malloc unconditionally. So with Gale every CONFIG_KERNEL_MEM_POOL build declared k_malloc but never defined it: 'undefined reference to k_malloc'. Only the source file is now conditional; the size computation and the definition are unchanged and always run with CONFIG_KERNEL_MEM_POOL. Measured in gale's upstream-vs-gale kernel delta (gale#401): the benchmark.kernel.core and benchmark.kernel.latency* suites. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011QG86sovTbfnPNY9SfhSmo
avrabe
force-pushed
the
fix/gale-mempool-keeps-heap-size
branch
from
September 17, 2026 17:39
c770980 to
3be234c
Compare
avrabe
added a commit
to pulseengine/gale
that referenced
this pull request
Sep 18, 2026
…e that the pin stays reachable) (#405) * fix(ci): pin the Zephyr fork by revision — CI cloned a branch nothing recorded All 15 `west init` sites cloned pulseengine/zephyr by BRANCH name (`--mr gale/sem-replacement`), so a run's Zephyr was whatever that branch held at the time and no gale commit recorded it. gale#401's 38 -> 0 kernel delta spanned exactly such a change (pulseengine/zephyr#1 merged mid-issue): the runs are honest, but not reproducible from gale's history alone. The revision now lives in .github/zephyr-fork-pin, read by every site, with a refusal if the file is empty. Taking a fork change becomes a reviewable bump, like any other pin. Pinned at 9550d256 (current branch head). New kill-criteria gate `zephyr-fork-pin`: the pin must be 40-hex AND still reachable from gale/sem-replacement (compare status identical|ahead), so a rebase or force-push on the fork fails here rather than in every Zephyr job at once. It carries its own negative control — an unreachable revision must be rejected by the same query. Both arms verified against the live fork: identical for the pin, ahead for its parent, 404 for a fabricated sha. The control branches on gh's EXIT STATUS: gh prints the 404 body to stdout, so a string compare would have failed the gate for the wrong reason. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011QG86sovTbfnPNY9SfhSmo * fix(ci): apply the fork pin after clone — west init --mr cannot take a SHA The first version passed the pinned revision to west init. west runs 'git clone --branch <rev>', which takes a branch or tag, so every Zephyr job failed at once: 'fatal: Remote branch 9550d256... not found in upstream origin' (56 checks). Each of the 15 sites now inits on gale/sem-replacement, then fetches and checks out the pinned revision in the manifest repo (<workspace>/zephyr, per the fork's west.yml 'self: path: zephyr') BEFORE west update reads it, and asserts HEAD equals the pin — an unpinned build would otherwise look identical in the log. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011QG86sovTbfnPNY9SfhSmo --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.
The Gale patch to
kernel/CMakeLists.txtskipped the entireCONFIG_KERNEL_MEM_POOLblock whenCONFIG_GALE_KERNEL_MEMPOOL=y. That block also holds the only definition ofK_HEAP_MEM_POOL_SIZE(zephyr_compile_definitions; checked across the tree).gale_mempool.cdefinesk_malloc,k_calloc,k_realloc,k_aligned_allocandk_thread_system_pool_assignonly under that macro, whilekernel.hdeclaresk_mallocunconditionally. So with Gale every mem-pool build declaredk_mallocand never defined it:undefined reference to k_malloc(gale#401).kernel.hguards onlyk_thread_system_pool_assignwith the macro. That makeskernel.threads.thread_stack's implicit declaration a likely second symptom, not yet confirmed.Only
mempool.cis now conditional; the heap-size computation is unchanged.Review: independent read-only review confirmed six of seven claims (single definition site, block skipped on base, balanced
if/endif, non-Gale behaviour identical, no duplicate symbols, no other changes). It refuted the original description's claim thatkernel.hguardsk_malloc, corrected above.Compliance check: Gitlint's line length is fixed. The remaining failures are fork-wide, not this change: no gale commit on
gale/sem-replacementcarriesSigned-off-by(all 7 were pushed directly), and the undefined-Kconfig findings are theCONFIG_GALE_KERNEL_*symbols that the external gale module defines.Not built here. gale's upstream-vs-gale job clones
gale/sem-replacementby name, so it measures this once merged. That same property means a merge changes every gale CI run immediately.🤖 Generated with Claude Code
https://claude.ai/code/session_011QG86sovTbfnPNY9SfhSmo