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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/mmapobj.c
          +++ new/usr/src/uts/common/os/mmapobj.c
↓ open down ↓ 301 lines elided ↑ open up ↑
 302  302  void
 303  303  lib_va_free(struct lib_va *lvp)
 304  304  {
 305  305          int is_64bit = lvp->lv_flags & LV_ELF64;
 306  306          ASSERT(lvp->lv_refcnt == 0);
 307  307  
 308  308          if (lvp->lv_base_va != NULL) {
 309  309                  vmem_xfree(is_64bit ? lib_va_64_arena : lib_va_32_arena,
 310  310                      lvp->lv_base_va, lvp->lv_len);
 311  311                  if (is_64bit) {
 312      -                        atomic_add_32(&libs_mapped_64, -1);
      312 +                        atomic_dec_32(&libs_mapped_64);
 313  313                  } else {
 314      -                        atomic_add_32(&libs_mapped_32, -1);
      314 +                        atomic_dec_32(&libs_mapped_32);
 315  315                  }
 316  316          }
 317  317          kmem_free(lvp, sizeof (struct lib_va));
 318  318  }
 319  319  
 320  320  /*
 321  321   * See if the file associated with the vap passed in is in the lib_va hash.
 322  322   * If it is and the file has not been modified since last use, then
 323  323   * return a pointer to that data.  Otherwise, return NULL if the file has
 324  324   * changed or the file was not found in the hash.
↓ open down ↓ 140 lines elided ↑ open up ↑
 465  465  
 466  466          if (model == DATAMODEL_LP64) {
 467  467                  lvp->lv_flags = LV_ELF64;
 468  468          } else {
 469  469                  ASSERT(model == DATAMODEL_ILP32);
 470  470                  lvp->lv_flags = LV_ELF32;
 471  471          }
 472  472  
 473  473          if (base_va != NULL) {
 474  474                  if (model == DATAMODEL_LP64) {
 475      -                        atomic_add_32(&libs_mapped_64, 1);
      475 +                        atomic_inc_32(&libs_mapped_64);
 476  476                  } else {
 477  477                          ASSERT(model == DATAMODEL_ILP32);
 478      -                        atomic_add_32(&libs_mapped_32, 1);
      478 +                        atomic_inc_32(&libs_mapped_32);
 479  479                  }
 480  480          }
 481  481          ASSERT(*tmp == NULL);
 482  482          *tmp = lvp;
 483  483          mutex_exit(LIB_VA_HASH_MUTEX(index));
 484  484          if (del) {
 485  485                  ASSERT(del->lv_refcnt == 0);
 486  486                  MOBJ_STAT_ADD(lib_va_add_delete);
 487  487                  lib_va_free(del);
 488  488          }
↓ open down ↓ 1947 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX