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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/dtrace/profile.c
          +++ new/usr/src/uts/common/dtrace/profile.c
↓ open down ↓ 163 lines elided ↑ open up ↑
 164  164  
 165  165          if (profile_aframes)
 166  166                  nr_frames = profile_aframes;
 167  167  
 168  168          if (interval < profile_interval_min)
 169  169                  return;
 170  170  
 171  171          if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0)
 172  172                  return;
 173  173  
 174      -        atomic_add_32(&profile_total, 1);
      174 +        atomic_inc_32(&profile_total);
 175  175          if (profile_total > profile_max) {
 176      -                atomic_add_32(&profile_total, -1);
      176 +                atomic_dec_32(&profile_total);
 177  177                  return;
 178  178          }
 179  179  
 180  180          prof = kmem_zalloc(sizeof (profile_probe_t), KM_SLEEP);
 181  181          (void) strcpy(prof->prof_name, name);
 182  182          prof->prof_interval = interval;
 183  183          prof->prof_cyclic = CYCLIC_NONE;
 184  184          prof->prof_kind = kind;
 185  185          prof->prof_id = dtrace_probe_create(profile_id,
 186  186              NULL, NULL, name, nr_frames, prof);
↓ open down ↓ 134 lines elided ↑ open up ↑
 321  321  /*ARGSUSED*/
 322  322  static void
 323  323  profile_destroy(void *arg, dtrace_id_t id, void *parg)
 324  324  {
 325  325          profile_probe_t *prof = parg;
 326  326  
 327  327          ASSERT(prof->prof_cyclic == CYCLIC_NONE);
 328  328          kmem_free(prof, sizeof (profile_probe_t));
 329  329  
 330  330          ASSERT(profile_total >= 1);
 331      -        atomic_add_32(&profile_total, -1);
      331 +        atomic_dec_32(&profile_total);
 332  332  }
 333  333  
 334  334  /*ARGSUSED*/
 335  335  static void
 336  336  profile_online(void *arg, cpu_t *cpu, cyc_handler_t *hdlr, cyc_time_t *when)
 337  337  {
 338  338          profile_probe_t *prof = arg;
 339  339          profile_probe_percpu_t *pcpu;
 340  340  
 341  341          pcpu = kmem_zalloc(sizeof (profile_probe_percpu_t), KM_SLEEP);
↓ open down ↓ 255 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX