Page MenuHomeFreeBSD

uma: Avoid depleting keg reserves when filling a bucket

Authored by markj on Oct 13 2020, 8:56 PM.



zone_import() fetches a free or partially free slab from the keg and
then uses its items to populate an array, typically filling a bucket.
If a single allocation causes the keg to drop below its minimum reserve,
the inner loop ends. However, if the bucket is still not full and
M_USE_RESERVE is specified, the outer loop will continue to fetch items
from the keg.

If M_USE_RESERVE is specified and the number of free items is below the
reserved limit, we should return only a single item. Otherwise, if the
bucket size is larger than the reserve, all of the reserved items may
end up in a single per-CPU bucket, invisible to other CPUs.

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj requested review of this revision.Oct 13 2020, 8:56 PM
markj created this revision.
3755–3759 ↗(On Diff #78193)

Should this be conditional on actually being at or below the reserve limit?

markj marked an inline comment as done.

Modify zone_import() to return as soon as the free count dips below the
reserve. This is still not perfect, since for round-robin zones we could
potentially continue allocating from other domains.

This revision is now accepted and ready to land.Oct 14 2020, 5:53 PM