Print this page
5255 uts shouldn't open-code ISP2

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/dtrace/fasttrap.c
          +++ new/usr/src/uts/common/dtrace/fasttrap.c
↓ open down ↓ 2148 lines elided ↑ open up ↑
2149 2149  
2150 2150          /*
2151 2151           * Conjure up the tracepoints hashtable...
2152 2152           */
2153 2153          nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
2154 2154              "fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE);
2155 2155  
2156 2156          if (nent == 0 || nent > 0x1000000)
2157 2157                  nent = FASTTRAP_TPOINTS_DEFAULT_SIZE;
2158 2158  
2159      -        if ((nent & (nent - 1)) == 0)
     2159 +        if (ISP2(nent))
2160 2160                  fasttrap_tpoints.fth_nent = nent;
2161 2161          else
2162 2162                  fasttrap_tpoints.fth_nent = 1 << fasttrap_highbit(nent);
2163 2163          ASSERT(fasttrap_tpoints.fth_nent > 0);
2164 2164          fasttrap_tpoints.fth_mask = fasttrap_tpoints.fth_nent - 1;
2165 2165          fasttrap_tpoints.fth_table = kmem_zalloc(fasttrap_tpoints.fth_nent *
2166 2166              sizeof (fasttrap_bucket_t), KM_SLEEP);
2167 2167  
2168 2168          /*
2169 2169           * ... and the providers hash table...
2170 2170           */
2171 2171          nent = FASTTRAP_PROVIDERS_DEFAULT_SIZE;
2172      -        if ((nent & (nent - 1)) == 0)
     2172 +        if (ISP2(nent))
2173 2173                  fasttrap_provs.fth_nent = nent;
2174 2174          else
2175 2175                  fasttrap_provs.fth_nent = 1 << fasttrap_highbit(nent);
2176 2176          ASSERT(fasttrap_provs.fth_nent > 0);
2177 2177          fasttrap_provs.fth_mask = fasttrap_provs.fth_nent - 1;
2178 2178          fasttrap_provs.fth_table = kmem_zalloc(fasttrap_provs.fth_nent *
2179 2179              sizeof (fasttrap_bucket_t), KM_SLEEP);
2180 2180  
2181 2181          /*
2182 2182           * ... and the procs hash table.
2183 2183           */
2184 2184          nent = FASTTRAP_PROCS_DEFAULT_SIZE;
2185      -        if ((nent & (nent - 1)) == 0)
     2185 +        if (ISP2(nent))
2186 2186                  fasttrap_procs.fth_nent = nent;
2187 2187          else
2188 2188                  fasttrap_procs.fth_nent = 1 << fasttrap_highbit(nent);
2189 2189          ASSERT(fasttrap_procs.fth_nent > 0);
2190 2190          fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1;
2191 2191          fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent *
2192 2192              sizeof (fasttrap_bucket_t), KM_SLEEP);
2193 2193  
2194 2194          (void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL,
2195 2195              &fasttrap_meta_id);
↓ open down ↓ 191 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX