| 49 | std::atomic<uint64_t> g_cores_used_mask{0}; |
| 50 | |
| 51 | void 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 | |
| 69 | void test_balance_imbalanced_load(void* /*arg*/) { |
| 70 | klog::Info("=== Balance: Imbalanced Load Test ==="); |
nothing calls this directly
no test coverage detected