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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/syscall/lwp_sobj.c
          +++ new/usr/src/uts/common/syscall/lwp_sobj.c
↓ open down ↓ 187 lines elided ↑ open up ↑
 188  188                                  if (ent->lwpchan_pool == LWPCHAN_MPPOOL &&
 189  189                                      (ent->lwpchan_type & USYNC_PROCESS_ROBUST))
 190  190                                          lwp_mutex_cleanup(ent, LOCK_UNMAPPED);
 191  191                                  /*
 192  192                                   * If there is a user-level robust lock
 193  193                                   * registration, mark it as invalid.
 194  194                                   */
 195  195                                  if ((addr = ent->lwpchan_uaddr) != NULL)
 196  196                                          lwp_mutex_unregister(addr);
 197  197                                  kmem_free(ent, sizeof (*ent));
 198      -                                atomic_add_32(&lcp->lwpchan_entries, -1);
      198 +                                atomic_dec_32(&lcp->lwpchan_entries);
 199  199                          } else {
 200  200                                  prev = &ent->lwpchan_next;
 201  201                          }
 202  202                  }
 203  203                  mutex_exit(&hashbucket->lwpchan_lock);
 204  204          }
 205  205          mutex_exit(&p->p_lcp_lock);
 206  206  }
 207  207  
 208  208  /*
↓ open down ↓ 252 lines elided ↑ open up ↑
 461  461                  lwpchan_alloc_cache(p, bits + 1);
 462  462                  goto top;
 463  463          }
 464  464          ent->lwpchan_addr = addr;
 465  465          ent->lwpchan_uaddr = uaddr;
 466  466          ent->lwpchan_type = (uint16_t)type;
 467  467          ent->lwpchan_pool = (uint16_t)pool;
 468  468          ent->lwpchan_lwpchan = *lwpchan;
 469  469          ent->lwpchan_next = hashbucket->lwpchan_chain;
 470  470          hashbucket->lwpchan_chain = ent;
 471      -        atomic_add_32(&lcp->lwpchan_entries, 1);
      471 +        atomic_inc_32(&lcp->lwpchan_entries);
 472  472          mutex_exit(&hashbucket->lwpchan_lock);
 473  473          return (1);
 474  474  }
 475  475  
 476  476  /*
 477  477   * Return a unique pair of identifiers that corresponds to a
 478  478   * synchronization object's virtual address.  Process-shared
 479  479   * sync objects usually get vnode/offset from as_getmemid().
 480  480   */
 481  481  static int
↓ open down ↓ 2723 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX