Skip to content

Global task registry assessment#118

Merged
FlareCoding merged 4 commits intopr/global-task-registryfrom
cursor/global-task-registry-assessment-495b
Apr 1, 2026
Merged

Global task registry assessment#118
FlareCoding merged 4 commits intopr/global-task-registryfrom
cursor/global-task-registry-assessment-495b

Conversation

@FlareCoding
Copy link
Copy Markdown
Owner

This pull request contains changes generated by a Cursor Cloud Agent

Open in Web Open in Cursor 

cursoragent and others added 2 commits April 1, 2026 03:35
…gistry

DS-tier tests (29 tests, no scheduler required):
- init/count: empty registry starts at zero
- insert: single, multiple, TID identity preservation, boundary TID values
- remove: single, from-many, first/last, never-inserted safety, empty registry,
  remove-all, double-remove safety
- reinsert: after remove, multiple cycles
- snapshot_tids: empty, single, multiple, max capping, zero max, after remove
- count tracking: incremental insert/removal, mixed operations
- stress: 64-task insert/remove patterns, full cycle reinsert with new TIDs
- consistency: snapshot agrees with count, reinit clears state
- link integrity: pprev null after remove

SCHED-tier integration tests (11 tests, real kernel tasks):
- created task appears in global registry before enqueue
- multiple created tasks all visible in registry
- count increases on task creation
- exited task eventually removed by reaper
- task visible while alive, gone after exit+reap
- batch exits all cleaned up
- snapshot captures running/sleeping tasks
- concurrent inserts from multiple CPUs via sub-task creation
- rapid create/exit waves don't corrupt registry
- count consistent with snapshot in quiescent state
- no duplicate TIDs in snapshot

All 500 tests pass on both x86_64 and aarch64.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
Cast intentionally-discarded [[nodiscard]] return values to (void):
- dma.test.cpp: dma::alloc_pages in page_alloc_free_no_leak
- poll_resource.test.cpp: ring_buffer_write in 4 test setup sites

All 500 tests pass warning-free on both x86_64 and aarch64.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 1, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

cursoragent and others added 2 commits April 1, 2026 03:53
Save task pointers across the RUN_ELEVATED block so all created tasks
can be enqueued after TID verification. Previously the pointers were
lost after the block exited, leaking 4 task structs, stacks, and
handles per test run and permanently polluting g_task_registry.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
…ation

Some CI runners use slow machines and smp::init() may not be able to
initialize all CPUs quickly enough. Sleep for 1 second to give the
APs a chance to fully initialize before running unit tests.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
@FlareCoding FlareCoding merged commit 2e1c316 into pr/global-task-registry Apr 1, 2026
15 checks passed
@FlareCoding FlareCoding deleted the cursor/global-task-registry-assessment-495b branch April 1, 2026 04:23
FlareCoding added a commit that referenced this pull request Apr 1, 2026
* test(sched): exhaustive unit and integration tests for global task registry

DS-tier tests (29 tests, no scheduler required):
- init/count: empty registry starts at zero
- insert: single, multiple, TID identity preservation, boundary TID values
- remove: single, from-many, first/last, never-inserted safety, empty registry,
  remove-all, double-remove safety
- reinsert: after remove, multiple cycles
- snapshot_tids: empty, single, multiple, max capping, zero max, after remove
- count tracking: incremental insert/removal, mixed operations
- stress: 64-task insert/remove patterns, full cycle reinsert with new TIDs
- consistency: snapshot agrees with count, reinit clears state
- link integrity: pprev null after remove

SCHED-tier integration tests (11 tests, real kernel tasks):
- created task appears in global registry before enqueue
- multiple created tasks all visible in registry
- count increases on task creation
- exited task eventually removed by reaper
- task visible while alive, gone after exit+reap
- batch exits all cleaned up
- snapshot captures running/sleeping tasks
- concurrent inserts from multiple CPUs via sub-task creation
- rapid create/exit waves don't corrupt registry
- count consistent with snapshot in quiescent state
- no duplicate TIDs in snapshot

All 500 tests pass on both x86_64 and aarch64.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

* fix(tests): suppress nodiscard warnings in dma and poll_resource tests

Cast intentionally-discarded [[nodiscard]] return values to (void):
- dma.test.cpp: dma::alloc_pages in page_alloc_free_no_leak
- poll_resource.test.cpp: ring_buffer_write in 4 test setup sites

All 500 tests pass warning-free on both x86_64 and aarch64.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

* fix(tests): fix task leak in multiple_tasks_appear integration test

Save task pointers across the RUN_ELEVATED block so all created tasks
can be enqueued after TID verification. Previously the pointers were
lost after the block exited, leaking 4 task structs, stacks, and
handles per test run and permanently polluting g_task_registry.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

* fix(boot): add 1s delay before unit tests to let APs finish initialization

Some CI runners use slow machines and smp::init() may not be able to
initialize all CPUs quickly enough. Sleep for 1 second to give the
APs a chance to fully initialize before running unit tests.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
FlareCoding added a commit that referenced this pull request Apr 1, 2026
… processes + stellux proc kill system call (#119)

* feat(sched): implemented a skeleton for the global system-wide task registry (hashmap-based)

* Global task registry assessment (#118)

* test(sched): exhaustive unit and integration tests for global task registry

DS-tier tests (29 tests, no scheduler required):
- init/count: empty registry starts at zero
- insert: single, multiple, TID identity preservation, boundary TID values
- remove: single, from-many, first/last, never-inserted safety, empty registry,
  remove-all, double-remove safety
- reinsert: after remove, multiple cycles
- snapshot_tids: empty, single, multiple, max capping, zero max, after remove
- count tracking: incremental insert/removal, mixed operations
- stress: 64-task insert/remove patterns, full cycle reinsert with new TIDs
- consistency: snapshot agrees with count, reinit clears state
- link integrity: pprev null after remove

SCHED-tier integration tests (11 tests, real kernel tasks):
- created task appears in global registry before enqueue
- multiple created tasks all visible in registry
- count increases on task creation
- exited task eventually removed by reaper
- task visible while alive, gone after exit+reap
- batch exits all cleaned up
- snapshot captures running/sleeping tasks
- concurrent inserts from multiple CPUs via sub-task creation
- rapid create/exit waves don't corrupt registry
- count consistent with snapshot in quiescent state
- no duplicate TIDs in snapshot

All 500 tests pass on both x86_64 and aarch64.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

* fix(tests): suppress nodiscard warnings in dma and poll_resource tests

Cast intentionally-discarded [[nodiscard]] return values to (void):
- dma.test.cpp: dma::alloc_pages in page_alloc_free_no_leak
- poll_resource.test.cpp: ring_buffer_write in 4 test setup sites

All 500 tests pass warning-free on both x86_64 and aarch64.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

* fix(tests): fix task leak in multiple_tasks_appear integration test

Save task pointers across the RUN_ELEVATED block so all created tasks
can be enqueued after TID verification. Previously the pointers were
lost after the block exited, leaking 4 task structs, stacks, and
handles per test run and permanently polluting g_task_registry.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

* fix(boot): add 1s delay before unit tests to let APs finish initialization

Some CI runners use slow machines and smp::init() may not be able to
initialize all CPUs quickly enough. Sleep for 1 second to give the
APs a chance to fully initialize before running unit tests.

Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>

* fix(poll/sched): fixed poll wake race that corrupted scheduler state

* feat(proc): added kill-by-TID syscall with registry lookup and userland kill utility

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
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