Page MenuHomeFreeBSD

uma: Fix handling of reserves in zone_import()
ClosedPublic

Authored by markj on Oct 15 2021, 10:00 PM.
Tags
None
Referenced Files
F166435800: D32516.id97805.diff
Thu, Aug 13, 1:49 PM
F166414658: D32516.id96936.diff
Thu, Aug 13, 12:13 PM
Unknown Object (File)
Wed, Aug 12, 11:00 PM
Unknown Object (File)
Wed, Aug 12, 10:20 PM
Unknown Object (File)
Tue, Aug 11, 11:51 PM
Unknown Object (File)
Mon, Aug 10, 6:36 PM
Unknown Object (File)
Mon, Aug 10, 5:44 PM
Unknown Object (File)
Mon, Aug 10, 5:44 PM
Subscribers

Details

Summary

Kegs with no items reserved have uk_reserve = 0. So the check
keg->uk_reserve >= dom->ud_free_items will be true once all slabs are
depleted. Then, rather than go and allocate a fresh slab, we return.

The intent was to do this only when the keg actually has a reserve, so
modify the check to verify this first. Another approach would be to
make uk_reserve signed and set it to -1 until uma_zone_reserve() is
called, but requires a few casts elsewhere.

The bug would cause us to go to the keg more often than necessary when
filling buckets. In a steady state I wouldn't expect it to make much of
a difference, but maybe I'm missing something. I noticed the problem by
code inspection.

Fixes: 1b2dcc8c54a8 ("uma: Avoid depleting keg reserves when filling a bucket")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable