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


1670                 }
1671                 /*
1672                  * Now let's change the scheduling class of this
1673                  * process if our target pool has it defined.
1674                  */
1675                 if (cid != POOL_CLASS_UNSET)
1676                         pool_change_class(p, cid);
1677 
1678                 /*
1679                  * It is safe to reference p_pool here without holding
1680                  * p_lock because it cannot change underneath of us.
1681                  * We're holding pool_lock here, so nobody else can be
1682                  * moving this process between pools.  If process "p"
1683                  * would be exiting, we're guaranteed that it would be blocked
1684                  * at pool_barrier_enter() in exit().  Otherwise, it would've
1685                  * been skipped by one of our scans of the practive list
1686                  * as a process with PEXITED flag set.
1687                  */
1688                 if (p->p_pool != pool) {
1689                         ASSERT(p->p_pool->pool_ref > 0);
1690                         atomic_add_32(&p->p_pool->pool_ref, -1);
1691                         p->p_pool = pool;
1692                         atomic_add_32(&p->p_pool->pool_ref, 1);
1693                 }
1694                 /*
1695                  * Okay, we've tortured this guy enough.
1696                  * Let this poor process go now.
1697                  */
1698                 pool_bind_wake(p);
1699         }
1700         if (flags & POOL_BIND_PSET)
1701                 pset_bind_finish();
1702 
1703 out:    switch (idtype) {
1704         case P_PROJID:
1705                 ASSERT(kpj != NULL);
1706                 mutex_exit(&kpj->kpj_poolbind);
1707                 project_rele(kpj);
1708                 break;
1709         case P_ZONEID:
1710                 if (rv == 0) {
1711                         mutex_enter(&cpu_lock);
1712                         zone_pool_set(zone, pool);




1670                 }
1671                 /*
1672                  * Now let's change the scheduling class of this
1673                  * process if our target pool has it defined.
1674                  */
1675                 if (cid != POOL_CLASS_UNSET)
1676                         pool_change_class(p, cid);
1677 
1678                 /*
1679                  * It is safe to reference p_pool here without holding
1680                  * p_lock because it cannot change underneath of us.
1681                  * We're holding pool_lock here, so nobody else can be
1682                  * moving this process between pools.  If process "p"
1683                  * would be exiting, we're guaranteed that it would be blocked
1684                  * at pool_barrier_enter() in exit().  Otherwise, it would've
1685                  * been skipped by one of our scans of the practive list
1686                  * as a process with PEXITED flag set.
1687                  */
1688                 if (p->p_pool != pool) {
1689                         ASSERT(p->p_pool->pool_ref > 0);
1690                         atomic_dec_32(&p->p_pool->pool_ref);
1691                         p->p_pool = pool;
1692                         atomic_inc_32(&p->p_pool->pool_ref);
1693                 }
1694                 /*
1695                  * Okay, we've tortured this guy enough.
1696                  * Let this poor process go now.
1697                  */
1698                 pool_bind_wake(p);
1699         }
1700         if (flags & POOL_BIND_PSET)
1701                 pset_bind_finish();
1702 
1703 out:    switch (idtype) {
1704         case P_PROJID:
1705                 ASSERT(kpj != NULL);
1706                 mutex_exit(&kpj->kpj_poolbind);
1707                 project_rele(kpj);
1708                 break;
1709         case P_ZONEID:
1710                 if (rv == 0) {
1711                         mutex_enter(&cpu_lock);
1712                         zone_pool_set(zone, pool);