threads(M1): address-space reference counting
Route address-space lifetime through a refcount keyed by the page-table root (scheduler.zig aspace_refs): retainAspace on the spawnUserLocked success path, releaseAspace from both teardown paths (exitUserLocked, destroyTaskLocked), destroying the space only when the last task on it exits. Behaviour is identical today (every space has exactly one task); this is the foundation shared-address- space threads (docs/threading.md) build on. Test-observable liveAspaceCount/aspaceDestroyCount + a new aspace-refcount kernel self-test and QEMU case: spawn and reap 5 ring-3 probes, assert live spaces return to baseline and destructions advance by exactly 5 (destroyed once each, no leak, no double-free). Gate passes; 13 guardrail cases green; build + host tests clean.
This commit is contained in:
@@ -293,6 +293,13 @@ CASES = [
|
||||
"timeout": 60,
|
||||
"expect": r"DANOS-TEST-RESULT: PASS",
|
||||
"fail": r"DANOS-TEST-RESULT: FAIL"},
|
||||
|
||||
# docs/threading-plan.md M1: address-space refcount — spaces destroyed exactly
|
||||
# once per process, no leak/double-free (the foundation shared-aspace threads need).
|
||||
{"name": "aspace-refcount",
|
||||
"timeout": 60,
|
||||
"expect": r"DANOS-TEST-RESULT: PASS",
|
||||
"fail": r"DANOS-TEST-RESULT: FAIL"},
|
||||
# Process arguments: argv arrives on the SysV entry stack (argv[0] = the spawned
|
||||
# name, argv[1..] = the system_spawn argument blob) and echoes back intact.
|
||||
{"name": "args",
|
||||
|
||||
Reference in New Issue
Block a user