Date: Mon, 15 Nov 2021 14:07:38 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: ce9c3848ff36 - stable/13 - uma: Fix handling of reserves in zone_import() Message-ID: <202111151407.1AFE7cRE006293@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ce9c3848ff369467749f59fd24f8b9f1241e725c commit ce9c3848ff369467749f59fd24f8b9f1241e725c Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-11-01 13:27:52 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-11-15 14:07:10 +0000 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 1fb066d71762..3888ff26cca8 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -3982,7 +3982,8 @@ zone_import(void *arg, void **bucket, int max, int domain, int flags) dom = &keg->uk_domain[slab->us_domain]; do { bucket[i++] = slab_alloc_item(keg, slab); - if (dom->ud_free_items <= keg->uk_reserve) { + if (keg->uk_reserve > 0 && + dom->ud_free_items <= keg->uk_reserve) { /* * Avoid depleting the reserve after a * successful item allocation, even if
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111151407.1AFE7cRE006293>