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

*** 602,621 **** int err; /* * Allocate an object from the cache. */ ! atomic_add_32(&str_count, 1); dsp = kmem_cache_alloc(str_cachep, KM_SLEEP); /* * Allocate the dummy mblk for flow-control. */ dsp->ds_tx_flow_mp = allocb(1, BPRI_HI); if (dsp->ds_tx_flow_mp == NULL) { kmem_cache_free(str_cachep, dsp); ! atomic_add_32(&str_count, -1); return (NULL); } dsp->ds_type = type; dsp->ds_major = major; dsp->ds_style = style; --- 602,621 ---- int err; /* * Allocate an object from the cache. */ ! atomic_inc_32(&str_count); dsp = kmem_cache_alloc(str_cachep, KM_SLEEP); /* * Allocate the dummy mblk for flow-control. */ dsp->ds_tx_flow_mp = allocb(1, BPRI_HI); if (dsp->ds_tx_flow_mp == NULL) { kmem_cache_free(str_cachep, dsp); ! atomic_dec_32(&str_count); return (NULL); } dsp->ds_type = type; dsp->ds_major = major; dsp->ds_style = style;
*** 708,718 **** /* * Free the object back to the cache. */ kmem_cache_free(str_cachep, dsp); ! atomic_add_32(&str_count, -1); } /* * kmem_cache contructor function: see kmem_cache_create(9f). */ --- 708,718 ---- /* * Free the object back to the cache. */ kmem_cache_free(str_cachep, dsp); ! atomic_dec_32(&str_count); } /* * kmem_cache contructor function: see kmem_cache_create(9f). */