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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/fork.c
          +++ new/usr/src/uts/common/os/fork.c
↓ open down ↓ 266 lines elided ↑ open up ↑
 267  267                          if (p->p_child == cp)
 268  268                                  p->p_child = cp->p_sibling;
 269  269                          if (cp->p_sibling)
 270  270                                  cp->p_sibling->p_psibling = cp->p_psibling;
 271  271                          if (cp->p_psibling)
 272  272                                  cp->p_psibling->p_sibling = cp->p_sibling;
 273  273                          mutex_enter(&cp->p_lock);
 274  274                          tk = cp->p_task;
 275  275                          task_detach(cp);
 276  276                          ASSERT(cp->p_pool->pool_ref > 0);
 277      -                        atomic_add_32(&cp->p_pool->pool_ref, -1);
      277 +                        atomic_dec_32(&cp->p_pool->pool_ref);
 278  278                          mutex_exit(&cp->p_lock);
 279  279                          pid_exit(cp, tk);
 280  280                          mutex_exit(&pidlock);
 281  281                          task_rele(tk);
 282  282  
 283  283                          mutex_enter(&p->p_lock);
 284  284                          p->p_flag &= ~SFORKING;
 285  285                          pool_barrier_exit();
 286  286                          continuelwps(p);
 287  287                          mutex_exit(&p->p_lock);
↓ open down ↓ 333 lines elided ↑ open up ↑
 621  621          rctl_set_free(cp->p_rctls);
 622  622          mutex_enter(&pidlock);
 623  623  
 624  624          /*
 625  625           * Detach failed child from task.
 626  626           */
 627  627          mutex_enter(&cp->p_lock);
 628  628          tk = cp->p_task;
 629  629          task_detach(cp);
 630  630          ASSERT(cp->p_pool->pool_ref > 0);
 631      -        atomic_add_32(&cp->p_pool->pool_ref, -1);
      631 +        atomic_dec_32(&cp->p_pool->pool_ref);
 632  632          mutex_exit(&cp->p_lock);
 633  633  
 634  634          orphpp = &p->p_orphan;
 635  635          while (*orphpp != cp)
 636  636                  orphpp = &(*orphpp)->p_nextorph;
 637  637          *orphpp = cp->p_nextorph;
 638  638          if (p->p_child == cp)
 639  639                  p->p_child = cp->p_sibling;
 640  640          if (cp->p_sibling)
 641  641                  cp->p_sibling->p_psibling = cp->p_psibling;
↓ open down ↓ 479 lines elided ↑ open up ↑
1121 1121           * Inherit pool pointer from the parent.  Kernel processes are
1122 1122           * always bound to the default pool.
1123 1123           */
1124 1124          mutex_enter(&pp->p_lock);
1125 1125          if (flags & GETPROC_KERNEL) {
1126 1126                  cp->p_pool = pool_default;
1127 1127                  cp->p_flag |= SSYS;
1128 1128          } else {
1129 1129                  cp->p_pool = pp->p_pool;
1130 1130          }
1131      -        atomic_add_32(&cp->p_pool->pool_ref, 1);
     1131 +        atomic_inc_32(&cp->p_pool->pool_ref);
1132 1132          mutex_exit(&pp->p_lock);
1133 1133  
1134 1134          /*
1135 1135           * Add the child process to the current task.  Kernel processes
1136 1136           * are always attached to task0.
1137 1137           */
1138 1138          mutex_enter(&cp->p_lock);
1139 1139          if (flags & GETPROC_KERNEL)
1140 1140                  task_attach(task0p, cp);
1141 1141          else
↓ open down ↓ 310 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX