Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/msacct.c
          +++ new/usr/src/uts/common/os/msacct.c
↓ open down ↓ 581 lines elided ↑ open up ↑
 582  582                          delta = newtime - hrlb;
 583  583                          if (delta < 0) {
 584  584                                  newtime = gethrtime_unscaled();
 585  585                                  delta = newtime - hrlb;
 586  586                          }
 587  587                          t->t_hrtime = newtime;
 588  588                          scalehrtime(&delta);
 589  589                          pctcpu = t->t_pctcpu;
 590  590                          npctcpu = cpu_decay(pctcpu, delta);
 591  591                  }
 592      -        } while (cas32(&t->t_pctcpu, pctcpu, npctcpu) != pctcpu);
      592 +        } while (atomic_cas_32(&t->t_pctcpu, pctcpu, npctcpu) != pctcpu);
 593  593  
 594  594          return (npctcpu);
 595  595  }
 596  596  
 597  597  /*
 598  598   * Change the microstate level for the LWP and update the
 599  599   * associated accounting information.  Return the previous
 600  600   * LWP state.
 601  601   */
 602  602  int
↓ open down ↓ 47 lines elided ↑ open up ↑
 650  650                  ztime = newtime = curtime - ms->ms_state_start;
 651  651                  if (newtime < 0) {
 652  652                          curtime = gethrtime_unscaled();
 653  653                          oldtime = *mstimep - 1; /* force CAS to fail */
 654  654                          continue;
 655  655                  }
 656  656                  oldtime = *mstimep;
 657  657                  newtime += oldtime;
 658  658                  t->t_mstate = new_state;
 659  659                  ms->ms_state_start = curtime;
 660      -        } while (cas64((uint64_t *)mstimep, oldtime, newtime) != oldtime);
      660 +        } while (atomic_cas_64((uint64_t *)mstimep, oldtime, newtime) !=
      661 +            oldtime);
 661  662  
 662  663          /*
 663  664           * When the system boots the initial startup thread will have a
 664  665           * ms_state_start of 0 which would add a huge system time to the global
 665  666           * zone.  We want to skip aggregating that initial bit of work.
 666  667           */
 667  668          if (origstart != 0) {
 668  669                  z = ttozone(t);
 669  670                  if (state == LMS_USER)
 670  671                          atomic_add_64(&z->zone_utime, ztime);
↓ open down ↓ 103 lines elided ↑ open up ↑
 774  775                  }
 775  776                  t->t_waitrq = 0;
 776  777                  newtime = waitrq - ms->ms_state_start;
 777  778                  if (newtime < 0) {
 778  779                          curtime = gethrtime_unscaled();
 779  780                          oldtime = *mstimep - 1; /* force CAS to fail */
 780  781                          continue;
 781  782                  }
 782  783                  oldtime = *mstimep;
 783  784                  newtime += oldtime;
 784      -        } while (cas64((uint64_t *)mstimep, oldtime, newtime) != oldtime);
      785 +        } while (atomic_cas_64((uint64_t *)mstimep, oldtime, newtime) !=
      786 +            oldtime);
 785  787  
 786  788          /*
 787  789           * Update the WAIT_CPU timer and per-cpu waitrq total.
 788  790           */
 789  791          z = ttozone(t);
 790  792          waittime = curtime - waitrq;
 791  793          ms->ms_acct[LMS_WAIT_CPU] += waittime;
 792  794          atomic_add_64(&z->zone_wtime, waittime);
 793  795          CPU->cpu_waitrq += waittime;
 794  796          ms->ms_state_start = curtime;
↓ open down ↓ 42 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX