MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / imbalance_worker

Function imbalance_worker

tests/system_test/balance_test.cpp:51–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49std::atomic<uint64_t> g_cores_used_mask{0};
50
51void imbalance_worker(void* /*arg*/) {
52 // Batch yields keep the task visible in the ready queue for Balance(),
53 // while periodic sleeps reduce scheduling pressure to avoid overwhelming
54 // the scheduler lock (which can trigger recursive-lock panics under
55 // extreme contention).
56 for (int round = 0; round < 200; ++round) {
57 for (int j = 0; j < 10; ++j) {
58 auto core_id = cpu_io::GetCurrentCoreId();
59 g_cores_used_mask.fetch_or(1UL << core_id, std::memory_order_relaxed);
60 (void)sys_yield();
61 }
62 (void)sys_sleep(1);
63 }
64
65 g_imbalance_done.fetch_add(1, std::memory_order_release);
66 sys_exit(0);
67}
68
69void test_balance_imbalanced_load(void* /*arg*/) {
70 klog::Info("=== Balance: Imbalanced Load Test ===");

Callers

nothing calls this directly

Calls 4

GetCurrentCoreIdFunction · 0.85
sys_yieldFunction · 0.85
sys_sleepFunction · 0.85
sys_exitFunction · 0.85

Tested by

no test coverage detected