Page MenuHomeFreeBSD

uma: Avoid depleting keg reserves when filling a bucket
ClosedPublic

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

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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.
sys/vm/uma_core.c
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