[rtems-libbsd commit] ZONE(9): Fix uma_zone_set_max()

Sebastian Huber sebh at rtems.org
Mon Oct 23 07:27:50 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    b9880143628ad4d1b2c7423d28d852988f7a469e
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=b9880143628ad4d1b2c7423d28d852988f7a469e

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Apr 26 15:02:00 2016 +0200

ZONE(9): Fix uma_zone_set_max()

Account for items provided for per-processor caches.

---

 freebsd/sys/vm/uma_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/freebsd/sys/vm/uma_core.c b/freebsd/sys/vm/uma_core.c
index f8c8476..840c876 100644
--- a/freebsd/sys/vm/uma_core.c
+++ b/freebsd/sys/vm/uma_core.c
@@ -3016,6 +3016,15 @@ uma_zone_set_max(uma_zone_t zone, int nitems)
 	if (keg == NULL)
 		return (0);
 	KEG_LOCK(keg);
+#ifdef __rtems__
+#ifdef SMP
+	/*
+	 * Ensure we have enough items to fill the per-processor caches.  This
+	 * is a heuristic approach and works not under all conditions.
+	 */
+	nitems += 2 * BUCKET_MAX * (mp_maxid + 1);
+#endif
+#endif /* __rtems__ */
 	keg->uk_maxpages = (nitems / keg->uk_ipers) * keg->uk_ppera;
 	if (keg->uk_maxpages * keg->uk_ipers < nitems)
 		keg->uk_maxpages += keg->uk_ppera;




More information about the vc mailing list