Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

*** 1356,1368 **** kthread_t *new) { pg_cmt_t *cmt_pg = (pg_cmt_t *)pg; if (old == cp->cpu_idle_thread) { ! atomic_add_32(&cmt_pg->cmt_utilization, 1); } else if (new == cp->cpu_idle_thread) { ! atomic_add_32(&cmt_pg->cmt_utilization, -1); } } /* * Macro to test whether a thread is currently runnable on a CPU in a PG. --- 1356,1368 ---- kthread_t *new) { pg_cmt_t *cmt_pg = (pg_cmt_t *)pg; if (old == cp->cpu_idle_thread) { ! atomic_inc_32(&cmt_pg->cmt_utilization); } else if (new == cp->cpu_idle_thread) { ! atomic_dec_32(&cmt_pg->cmt_utilization); } } /* * Macro to test whether a thread is currently runnable on a CPU in a PG.
*** 1381,1391 **** cpupm_domain_t *dom; uint32_t u; if (old == cp->cpu_idle_thread) { ASSERT(new != cp->cpu_idle_thread); ! u = atomic_add_32_nv(&cmt->cmt_utilization, 1); if (u == 1) { /* * Notify the CPU power manager that the domain * is non-idle. */ --- 1381,1391 ---- cpupm_domain_t *dom; uint32_t u; if (old == cp->cpu_idle_thread) { ASSERT(new != cp->cpu_idle_thread); ! u = atomic_inc_32_nv(&cmt->cmt_utilization); if (u == 1) { /* * Notify the CPU power manager that the domain * is non-idle. */
*** 1393,1403 **** cpupm_utilization_event(cp, now, dom, CPUPM_DOM_BUSY_FROM_IDLE); } } else if (new == cp->cpu_idle_thread) { ASSERT(old != cp->cpu_idle_thread); ! u = atomic_add_32_nv(&cmt->cmt_utilization, -1); if (u == 0) { /* * The domain is idle, notify the CPU power * manager. * --- 1393,1403 ---- cpupm_utilization_event(cp, now, dom, CPUPM_DOM_BUSY_FROM_IDLE); } } else if (new == cp->cpu_idle_thread) { ASSERT(old != cp->cpu_idle_thread); ! u = atomic_dec_32_nv(&cmt->cmt_utilization); if (u == 0) { /* * The domain is idle, notify the CPU power * manager. *