* Free a number of items back to the limit. */
| 3973 | * Free a number of items back to the limit. |
| 3974 | */ |
| 3975 | static void |
| 3976 | zone_free_limit(uma_zone_t zone, int count) |
| 3977 | { |
| 3978 | uint64_t old; |
| 3979 | |
| 3980 | MPASS(count > 0); |
| 3981 | |
| 3982 | /* |
| 3983 | * In the common case we either have no sleepers or |
| 3984 | * are still over the limit and can just return. |
| 3985 | */ |
| 3986 | old = atomic_fetchadd_64(&zone->uz_items, -count); |
| 3987 | if (__predict_true(UZ_ITEMS_SLEEPERS(old) == 0 || |
| 3988 | UZ_ITEMS_COUNT(old) - count >= zone->uz_max_items)) |
| 3989 | return; |
| 3990 | |
| 3991 | /* |
| 3992 | * Moderate the rate of wakeups. Sleepers will continue |
| 3993 | * to generate wakeups if necessary. |
| 3994 | */ |
| 3995 | wakeup_one(&zone->uz_max_items); |
| 3996 | } |
| 3997 | |
| 3998 | static uma_bucket_t |
| 3999 | zone_alloc_bucket(uma_zone_t zone, void *udata, int domain, int flags) |
no test coverage detected