| 1983 | return ws_scan_q(v, u->idle_worker, true); |
| 1984 | } |
| 1985 | static bool try_work_stealing(vcpu_t* vcpu) { |
| 1986 | assert(CURRENT->get_vcpu() == vcpu); |
| 1987 | assert(CURRENT == vcpu->idle_worker); |
| 1988 | if (0 == (vcpu->flags & VCPU_ENABLE_ACTIVE_WORK_STEALING)) |
| 1989 | return false; |
| 1990 | scoped_rwlock _(vcpu_list_rwlock, RLOCK); |
| 1991 | auto u = vcpu->next; |
| 1992 | while (u != vcpu) { |
| 1993 | if (0 == (u->flags & VCPU_ENABLE_PASSIVE_WORK_STEALING)) |
| 1994 | continue; |
| 1995 | thread* th; |
| 1996 | if ((th = ws_scan_standbyq(vcpu, u)) || (th = ws_scan_runq(vcpu, u))) { |
| 1997 | vcpu->idle_worker->insert_list_tail(th); |
| 1998 | return true; |
| 1999 | } |
| 2000 | SCOPED_LOCK(vcpu_list_lock); |
| 2001 | u = u->next; |
| 2002 | } |
| 2003 | return false; |
| 2004 | } |
| 2005 | static void* idler(void*) { |
| 2006 | RunQ rq; |
| 2007 | auto last_idle = now; |
no test coverage detected