mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-16 01:42:56 +08:00
ZONE(9): Fix uma_zone_set_max()
Account for items provided for per-processor caches.
This commit is contained in:
@@ -3016,6 +3016,15 @@ uma_zone_set_max(uma_zone_t zone, int nitems)
|
|||||||
if (keg == NULL)
|
if (keg == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
KEG_LOCK(keg);
|
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;
|
keg->uk_maxpages = (nitems / keg->uk_ipers) * keg->uk_ppera;
|
||||||
if (keg->uk_maxpages * keg->uk_ipers < nitems)
|
if (keg->uk_maxpages * keg->uk_ipers < nitems)
|
||||||
keg->uk_maxpages += keg->uk_ppera;
|
keg->uk_maxpages += keg->uk_ppera;
|
||||||
|
Reference in New Issue
Block a user