git: f9677b7e742c - stable/13 - uma: Don't allow a limit to be set in a warm zone

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 13 Apr 2022 12:12:58 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=f9677b7e742c95bdb94ee5da8a4fba14c9010a6e

commit f9677b7e742c95bdb94ee5da8a4fba14c9010a6e
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-30 19:42:18 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-04-13 12:10:35 +0000

    uma: Don't allow a limit to be set in a warm zone
    
    The limit accounting in UMA does not tolerate this.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d53927b0bae45bf5b4b206b2dddf37bab319a1b3)
---
 sys/vm/uma_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 211198d02d04..754e9d9ff15e 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -4791,6 +4791,8 @@ uma_zone_set_max(uma_zone_t zone, int nitems)
 	 * way to clear a limit.
 	 */
 	ZONE_LOCK(zone);
+	if (zone->uz_max_items == 0)
+		ZONE_ASSERT_COLD(zone);
 	zone->uz_max_items = nitems;
 	zone->uz_flags |= UMA_ZFLAG_LIMIT;
 	zone_update_caches(zone);