Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/seg_vn.c
          +++ new/usr/src/uts/common/vm/seg_vn.c
↓ open down ↓ 9703 lines elided ↑ open up ↑
9704 9704                   */
9705 9705                  lgrp_id = lgrp_home_id(curthread);
9706 9706          }
9707 9707          /*
9708 9708           * Set p_tr_lgrpid to lgrpid if it hasn't been set yet.  Otherwise
9709 9709           * just set it to NLGRPS_MAX if it's different from current process T1
9710 9710           * home lgrp.  p_tr_lgrpid is used to detect if process uses text
9711 9711           * replication and T1 new home is different from lgrp used for text
9712 9712           * replication. When this happens asyncronous segvn thread rechecks if
9713 9713           * segments should change lgrps used for text replication.  If we fail
9714      -         * to set p_tr_lgrpid with cas32 then set it to NLGRPS_MAX without cas
9715      -         * if it's not already NLGRPS_MAX and not equal lgrp_id we want to
9716      -         * use.  We don't need to use cas in this case because another thread
9717      -         * that races in between our non atomic check and set may only change
9718      -         * p_tr_lgrpid to NLGRPS_MAX at this point.
     9714 +         * to set p_tr_lgrpid with atomic_cas_32 then set it to NLGRPS_MAX
     9715 +         * without cas if it's not already NLGRPS_MAX and not equal lgrp_id
     9716 +         * we want to use.  We don't need to use cas in this case because
     9717 +         * another thread that races in between our non atomic check and set
     9718 +         * may only change p_tr_lgrpid to NLGRPS_MAX at this point.
9719 9719           */
9720 9720          ASSERT(lgrp_id != LGRP_NONE && lgrp_id < NLGRPS_MAX);
9721 9721          olid = p->p_tr_lgrpid;
9722 9722          if (lgrp_id != olid && olid != NLGRPS_MAX) {
9723 9723                  lgrp_id_t nlid = (olid == LGRP_NONE) ? lgrp_id : NLGRPS_MAX;
9724      -                if (cas32((uint32_t *)&p->p_tr_lgrpid, olid, nlid) != olid) {
     9724 +                if (atomic_cas_32((uint32_t *)&p->p_tr_lgrpid, olid, nlid) !=
     9725 +                    olid) {
9725 9726                          olid = p->p_tr_lgrpid;
9726 9727                          ASSERT(olid != LGRP_NONE);
9727 9728                          if (olid != lgrp_id && olid != NLGRPS_MAX) {
9728 9729                                  p->p_tr_lgrpid = NLGRPS_MAX;
9729 9730                          }
9730 9731                  }
9731 9732                  ASSERT(p->p_tr_lgrpid != LGRP_NONE);
9732 9733                  membar_producer();
9733 9734                  /*
9734 9735                   * lgrp_move_thread() won't schedule async recheck after
↓ open down ↓ 397 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX