| 192 | } |
| 193 | |
| 194 | uma_zone_t |
| 195 | pbuf_zsecond_create(const char *name, int max) |
| 196 | { |
| 197 | uma_zone_t zone; |
| 198 | |
| 199 | zone = uma_zsecond_create(name, pbuf_ctor, pbuf_dtor, NULL, NULL, |
| 200 | pbuf_zone); |
| 201 | /* |
| 202 | * uma_prealloc() rounds up to items per slab. If we would prealloc |
| 203 | * immediately on every pbuf_zsecond_create(), we may accumulate too |
| 204 | * much of difference between hard limit and prealloced items, which |
| 205 | * means wasted memory. |
| 206 | */ |
| 207 | if (nswbuf_max > 0) |
| 208 | nswbuf_max += uma_zone_set_max(zone, max); |
| 209 | else |
| 210 | uma_prealloc(pbuf_zone, uma_zone_set_max(zone, max)); |
| 211 | |
| 212 | return (zone); |
| 213 | } |
| 214 | |
| 215 | static void |
| 216 | pbuf_prealloc(void *arg __unused) |
no test coverage detected