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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/rpc/clnt_cots.c
          +++ new/usr/src/uts/common/rpc/clnt_cots.c
↓ open down ↓ 457 lines elided ↑ open up ↑
 458  458          { "timeouts",   KSTAT_DATA_UINT64 },
 459  459          { "newcreds",   KSTAT_DATA_UINT64 },
 460  460          { "badverfs",   KSTAT_DATA_UINT64 },
 461  461          { "timers",     KSTAT_DATA_UINT64 },
 462  462          { "cantconn",   KSTAT_DATA_UINT64 },
 463  463          { "nomem",      KSTAT_DATA_UINT64 },
 464  464          { "interrupts", KSTAT_DATA_UINT64 }
 465  465  };
 466  466  
 467  467  #define COTSRCSTAT_INCR(p, x)   \
 468      -        atomic_add_64(&(p)->x.value.ui64, 1)
      468 +        atomic_inc_64(&(p)->x.value.ui64)
 469  469  
 470  470  #define CLNT_MAX_CONNS  1       /* concurrent connections between clnt/srvr */
 471  471  int clnt_max_conns = CLNT_MAX_CONNS;
 472  472  
 473  473  #define CLNT_MIN_TIMEOUT        10      /* seconds to wait after we get a */
 474  474                                          /* connection reset */
 475  475  #define CLNT_MIN_CONNTIMEOUT    5       /* seconds to wait for a connection */
 476  476  
 477  477  
 478  478  int clnt_cots_min_tout = CLNT_MIN_TIMEOUT;
↓ open down ↓ 2309 lines elided ↑ open up ↑
2788 2788           * are reusing a connection and so we do not need to create
2789 2789           * another kstat -- lets just return.
2790 2790           */
2791 2791          if (cm_entry->x_ksp != NULL)
2792 2792                  return (TRUE);
2793 2793  
2794 2794          /*
2795 2795           * We need to increment rpc_kstat_instance atomically to prevent
2796 2796           * two kstats being created with the same instance.
2797 2797           */
2798      -        kstat_instance = atomic_add_32_nv((uint32_t *)&rpc_kstat_instance, 1);
     2798 +        kstat_instance = atomic_inc_32_nv((uint32_t *)&rpc_kstat_instance);
2799 2799  
2800 2800          if ((cm_entry->x_ksp = kstat_create_zone("unix", kstat_instance,
2801 2801              "rpc_cots_connections", "rpc", KSTAT_TYPE_NAMED,
2802 2802              (uint_t)(sizeof (cm_kstat_xprt_t) / sizeof (kstat_named_t)),
2803 2803              KSTAT_FLAG_VIRTUAL, cm_entry->x_zoneid)) == NULL) {
2804 2804                  return (TRUE);
2805 2805          }
2806 2806  
2807 2807          cm_entry->x_ksp->ks_lock = &connmgr_lock;
2808 2808          cm_entry->x_ksp->ks_private = cm_entry;
↓ open down ↓ 942 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX