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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/kcpc.c
          +++ new/usr/src/uts/common/os/kcpc.c
↓ open down ↓ 930 lines elided ↑ open up ↑
 931  931           * after the instruction that caused the overflow by which time
 932  932           * we're in some part of the kernel, not necessarily running on
 933  933           * the right thread).
 934  934           *
 935  935           * Check for this case here -- find the pinned thread
 936  936           * that was running when the interrupt went off.
 937  937           */
 938  938          if (t->t_flag & T_INTR_THREAD) {
 939  939                  klwp_t *lwp;
 940  940  
 941      -                atomic_add_32(&kcpc_intrctx_count, 1);
      941 +                atomic_inc_32(&kcpc_intrctx_count);
 942  942  
 943  943                  /*
 944  944                   * Note that t_lwp is always set to point at the underlying
 945  945                   * thread, thus this will work in the presence of nested
 946  946                   * interrupts.
 947  947                   */
 948  948                  ctx = NULL;
 949  949                  if ((lwp = t->t_lwp) != NULL) {
 950  950                          t = lwptot(lwp);
 951  951                          ctx = t->t_cpc_ctx;
↓ open down ↓ 49 lines elided ↑ open up ↑
1001 1001                   * code and no valid context will be found. The default behavior
1002 1002                   * when no valid context is found is now to shout a warning to
1003 1003                   * the console and bump the 'kcpc_nullctx_count' variable.
1004 1004                   */
1005 1005                  if (kcpc_nullctx_panic)
1006 1006                          panic("null cpc context, thread %p", (void *)t);
1007 1007  #ifdef DEBUG
1008 1008                  cmn_err(CE_NOTE,
1009 1009                      "null cpc context found in overflow handler!\n");
1010 1010  #endif
1011      -                atomic_add_32(&kcpc_nullctx_count, 1);
     1011 +                atomic_inc_32(&kcpc_nullctx_count);
1012 1012          } else if ((ctx->kc_flags & KCPC_CTX_INVALID) == 0) {
1013 1013                  /*
1014 1014                   * Schedule an ast to sample the counters, which will
1015 1015                   * propagate any overflow into the virtualized performance
1016 1016                   * counter(s), and may deliver a signal.
1017 1017                   */
1018 1018                  ttolwp(t)->lwp_pcb.pcb_flags |= CPC_OVERFLOW;
1019 1019                  /*
1020 1020                   * If a counter has overflowed which was counting on behalf of
1021 1021                   * a request which specified CPC_OVF_NOTIFY_EMT, send the
↓ open down ↓ 1492 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX