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


2385         struct vmap     snfv_vml[SNF_MAXVMAPS];
2386 } snf_vmap_desbinfo;
2387 
2388 typedef struct {
2389         frtn_t          snfi_frtn;
2390         caddr_t         snfi_base;
2391         uint_t          snfi_mapoff;
2392         size_t          snfi_len;
2393         vnode_t         *snfi_vp;
2394 } snf_smap_desbinfo;
2395 
2396 /*
2397  * The callback function used for vpm mapped mblks called when the last ref of
2398  * the mblk is dropped which normally occurs when TCP receives the ack. But it
2399  * can be the driver too due to lazy reclaim.
2400  */
2401 void
2402 snf_vmap_desbfree(snf_vmap_desbinfo *snfv)
2403 {
2404         ASSERT(snfv->snfv_ref != 0);
2405         if (atomic_add_32_nv(&snfv->snfv_ref, -1) == 0) {
2406                 vpm_unmap_pages(snfv->snfv_vml, S_READ);
2407                 VN_RELE(snfv->snfv_vp);
2408                 kmem_free(snfv, sizeof (snf_vmap_desbinfo));
2409         }
2410 }
2411 
2412 /*
2413  * The callback function used for segmap'ped mblks called when the last ref of
2414  * the mblk is dropped which normally occurs when TCP receives the ack. But it
2415  * can be the driver too due to lazy reclaim.
2416  */
2417 void
2418 snf_smap_desbfree(snf_smap_desbinfo *snfi)
2419 {
2420         if (! IS_KPM_ADDR(snfi->snfi_base)) {
2421                 /*
2422                  * We don't need to call segmap_fault(F_SOFTUNLOCK) for
2423                  * segmap_kpm as long as the latter never falls back to
2424                  * "use_segmap_range". (See segmap_getmapflt().)
2425                  *




2385         struct vmap     snfv_vml[SNF_MAXVMAPS];
2386 } snf_vmap_desbinfo;
2387 
2388 typedef struct {
2389         frtn_t          snfi_frtn;
2390         caddr_t         snfi_base;
2391         uint_t          snfi_mapoff;
2392         size_t          snfi_len;
2393         vnode_t         *snfi_vp;
2394 } snf_smap_desbinfo;
2395 
2396 /*
2397  * The callback function used for vpm mapped mblks called when the last ref of
2398  * the mblk is dropped which normally occurs when TCP receives the ack. But it
2399  * can be the driver too due to lazy reclaim.
2400  */
2401 void
2402 snf_vmap_desbfree(snf_vmap_desbinfo *snfv)
2403 {
2404         ASSERT(snfv->snfv_ref != 0);
2405         if (atomic_dec_32_nv(&snfv->snfv_ref) == 0) {
2406                 vpm_unmap_pages(snfv->snfv_vml, S_READ);
2407                 VN_RELE(snfv->snfv_vp);
2408                 kmem_free(snfv, sizeof (snf_vmap_desbinfo));
2409         }
2410 }
2411 
2412 /*
2413  * The callback function used for segmap'ped mblks called when the last ref of
2414  * the mblk is dropped which normally occurs when TCP receives the ack. But it
2415  * can be the driver too due to lazy reclaim.
2416  */
2417 void
2418 snf_smap_desbfree(snf_smap_desbinfo *snfi)
2419 {
2420         if (! IS_KPM_ADDR(snfi->snfi_base)) {
2421                 /*
2422                  * We don't need to call segmap_fault(F_SOFTUNLOCK) for
2423                  * segmap_kpm as long as the latter never falls back to
2424                  * "use_segmap_range". (See segmap_getmapflt().)
2425                  *