]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
uma: Fix handling of reserves in zone_import()
authorMark Johnston <markj@FreeBSD.org>
Mon, 1 Nov 2021 13:27:52 +0000 (09:27 -0400)
committerMark Johnston <markj@FreeBSD.org>
Mon, 15 Nov 2021 14:07:10 +0000 (09:07 -0500)
commitce9c3848ff369467749f59fd24f8b9f1241e725c
tree88c7ab20dad2d7b4cd85949f77ddbf40684ac065
parentd5ebaa6f8f850bb6f6273f01386832efcb295827
uma: Fix handling of reserves in zone_import()

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 to
the cache layer.

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 this requires a few casts elsewhere.

Fixes: 1b2dcc8c54a8 ("uma: Avoid depleting keg reserves when filling a bucket")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7585c5db25b700d19baebd7afd7a1b2e03c29cda)
sys/vm/uma_core.c