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

*** 1086,1096 **** /* * In either case, we increment softlockcnt on the 'real' segment. */ sptd->spt_pcachecnt++; ! atomic_add_long((ulong_t *)(&(shmd->shm_softlockcnt)), 1); ppa = sptd->spt_ppa; for (an_idx = pg_idx; an_idx < pg_idx + npages; ) { if (ppa[an_idx] == NULL) { mutex_exit(&sptd->spt_lock); --- 1086,1096 ---- /* * In either case, we increment softlockcnt on the 'real' segment. */ sptd->spt_pcachecnt++; ! atomic_inc_ulong((ulong_t *)(&(shmd->shm_softlockcnt))); ppa = sptd->spt_ppa; for (an_idx = pg_idx; an_idx < pg_idx + npages; ) { if (ppa[an_idx] == NULL) { mutex_exit(&sptd->spt_lock);
*** 1365,1375 **** /* * In either case, we increment softlockcnt on the 'real' segment. */ sptd->spt_pcachecnt++; ! atomic_add_long((ulong_t *)(&(shmd->shm_softlockcnt)), 1); /* * We can now drop the sptd->spt_lock since the ppa[] * exists and he have incremented pacachecnt. */ --- 1365,1375 ---- /* * In either case, we increment softlockcnt on the 'real' segment. */ sptd->spt_pcachecnt++; ! atomic_inc_ulong((ulong_t *)(&(shmd->shm_softlockcnt))); /* * We can now drop the sptd->spt_lock since the ppa[] * exists and he have incremented pacachecnt. */
*** 1517,1527 **** /* * Now decrement softlockcnt. */ ASSERT(shmd->shm_softlockcnt > 0); ! atomic_add_long((ulong_t *)(&(shmd->shm_softlockcnt)), -1); if (shmd->shm_softlockcnt <= 0) { if (async || AS_ISUNMAPWAIT(seg->s_as)) { mutex_enter(&seg->s_as->a_contents); if (async) --- 1517,1527 ---- /* * Now decrement softlockcnt. */ ASSERT(shmd->shm_softlockcnt > 0); ! atomic_dec_ulong((ulong_t *)(&(shmd->shm_softlockcnt))); if (shmd->shm_softlockcnt <= 0) { if (async || AS_ISUNMAPWAIT(seg->s_as)) { mutex_enter(&seg->s_as->a_contents); if (async)
*** 2909,2919 **** * in the as_pageunlock path and hopefully get the segment * kicked out of the seg_pcache. We bump the shm_softlockcnt * to keep this segment resident. */ writer = AS_WRITE_HELD(seg->s_as, &seg->s_as->a_lock); ! atomic_add_long((ulong_t *)(&(shmd->shm_softlockcnt)), 1); AS_LOCK_EXIT(seg->s_as, &seg->s_as->a_lock); mutex_enter(&sptd->spt_lock); end_lbolt = ddi_get_lbolt() + (hz * spt_pcache_wait); --- 2909,2919 ---- * in the as_pageunlock path and hopefully get the segment * kicked out of the seg_pcache. We bump the shm_softlockcnt * to keep this segment resident. */ writer = AS_WRITE_HELD(seg->s_as, &seg->s_as->a_lock); ! atomic_inc_ulong((ulong_t *)(&(shmd->shm_softlockcnt))); AS_LOCK_EXIT(seg->s_as, &seg->s_as->a_lock); mutex_enter(&sptd->spt_lock); end_lbolt = ddi_get_lbolt() + (hz * spt_pcache_wait);
*** 2933,2943 **** mutex_exit(&sptd->spt_lock); /* Regrab the AS_LOCK and release our hold on the segment */ AS_LOCK_ENTER(seg->s_as, &seg->s_as->a_lock, writer ? RW_WRITER : RW_READER); ! atomic_add_long((ulong_t *)(&(shmd->shm_softlockcnt)), -1); if (shmd->shm_softlockcnt <= 0) { if (AS_ISUNMAPWAIT(seg->s_as)) { mutex_enter(&seg->s_as->a_contents); if (AS_ISUNMAPWAIT(seg->s_as)) { AS_CLRUNMAPWAIT(seg->s_as); --- 2933,2943 ---- mutex_exit(&sptd->spt_lock); /* Regrab the AS_LOCK and release our hold on the segment */ AS_LOCK_ENTER(seg->s_as, &seg->s_as->a_lock, writer ? RW_WRITER : RW_READER); ! atomic_dec_ulong((ulong_t *)(&(shmd->shm_softlockcnt))); if (shmd->shm_softlockcnt <= 0) { if (AS_ISUNMAPWAIT(seg->s_as)) { mutex_enter(&seg->s_as->a_contents); if (AS_ISUNMAPWAIT(seg->s_as)) { AS_CLRUNMAPWAIT(seg->s_as);