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

@@ -1180,11 +1180,11 @@
         for (fprc = bucket->ftb_data; fprc != NULL; fprc = fprc->ftpc_next) {
                 if (fprc->ftpc_pid == pid && fprc->ftpc_acount != 0) {
                         mutex_enter(&fprc->ftpc_mtx);
                         mutex_exit(&bucket->ftb_mtx);
                         fprc->ftpc_rcount++;
-                        atomic_add_64(&fprc->ftpc_acount, 1);
+                        atomic_inc_64(&fprc->ftpc_acount);
                         ASSERT(fprc->ftpc_acount <= fprc->ftpc_rcount);
                         mutex_exit(&fprc->ftpc_mtx);
 
                         return (fprc);
                 }

@@ -1210,11 +1210,11 @@
         for (fprc = bucket->ftb_data; fprc != NULL; fprc = fprc->ftpc_next) {
                 if (fprc->ftpc_pid == pid && fprc->ftpc_acount != 0) {
                         mutex_enter(&fprc->ftpc_mtx);
                         mutex_exit(&bucket->ftb_mtx);
                         fprc->ftpc_rcount++;
-                        atomic_add_64(&fprc->ftpc_acount, 1);
+                        atomic_inc_64(&fprc->ftpc_acount);
                         ASSERT(fprc->ftpc_acount <= fprc->ftpc_rcount);
                         mutex_exit(&fprc->ftpc_mtx);
 
                         kmem_free(new_fprc, sizeof (fasttrap_proc_t));
 

@@ -1422,11 +1422,11 @@
         /*
          * If this provider hasn't been retired, we need to explicitly drop the
          * count of active providers on the associated process structure.
          */
         if (!provider->ftp_retired) {
-                atomic_add_64(&provider->ftp_proc->ftpc_acount, -1);
+                atomic_dec_64(&provider->ftp_proc->ftpc_acount);
                 ASSERT(provider->ftp_proc->ftpc_acount <
                     provider->ftp_proc->ftpc_rcount);
         }
 
         fasttrap_proc_release(provider->ftp_proc);

@@ -1497,11 +1497,11 @@
          * before calling into the DTrace framework since we acquire the
          * provider lock in callbacks invoked from the DTrace framework. The
          * bucket lock therefore protects the integrity of the provider hash
          * table.
          */
-        atomic_add_64(&fp->ftp_proc->ftpc_acount, -1);
+        atomic_dec_64(&fp->ftp_proc->ftpc_acount);
         ASSERT(fp->ftp_proc->ftpc_acount < fp->ftp_proc->ftpc_rcount);
 
         fp->ftp_retired = 1;
         fp->ftp_marked = 1;
         provid = fp->ftp_provid;

@@ -1593,14 +1593,14 @@
 
                         if (dtrace_probe_lookup(provider->ftp_provid,
                             pdata->ftps_mod, pdata->ftps_func, name_str) != 0)
                                 continue;
 
-                        atomic_add_32(&fasttrap_total, 1);
+                        atomic_inc_32(&fasttrap_total);
 
                         if (fasttrap_total > fasttrap_max) {
-                                atomic_add_32(&fasttrap_total, -1);
+                                atomic_dec_32(&fasttrap_total);
                                 goto no_mem;
                         }
 
                         pp = kmem_zalloc(sizeof (fasttrap_probe_t), KM_SLEEP);