Page MenuHomeFreeBSD

uma: Implement a non-strict first-touch policy for slab allocation
Needs ReviewPublic

Authored by markj on Mar 5 2021, 10:51 PM.
Tags
None
Referenced Files
F102731102: D29105.diff
Sat, Nov 16, 11:44 AM
Unknown Object (File)
Thu, Oct 31, 9:36 PM
Unknown Object (File)
Sat, Oct 19, 12:32 PM
Unknown Object (File)
Oct 16 2024, 7:36 AM
Unknown Object (File)
Oct 14 2024, 12:01 AM
Unknown Object (File)
Oct 8 2024, 10:03 AM
Unknown Object (File)
Oct 1 2024, 12:21 PM
Unknown Object (File)
Sep 30 2024, 6:22 PM
Subscribers

Details

Summary

Without this change, UMA uses a strict implementation of first-touch: if
the local domain does not have any free pages, UMA will either return
failure or sleep even if other domains have plenty of free pages.

The implementation came from before we had cross-domain frees, and the
first-touch policy was only used for the bucket zones (for which
allocations are always M_NOWAIT). Now it makes more sense to permit UMA
to allocate from other domains if necessary to make progress.

The change modifies the keg's domainset_ref to always point to the
correct policy, and modifies keg_fetch_slab() to simply iterate using
the keg's domainset reference.

N.B.: a lot of the complexity in keg_fetch_slab() came from wanting to
ensure that the per-keg domain iterator is updated atomically. However,
this was broken by commit 8b987a77691da95f and I don't see a nice way to
fix it. We don't have a global keg lock anymore. We could perhaps add
an iterator type that works atomically, or add a per-CPU array of
domainset refs and bracket updates to the iterator with critical
enter/exit.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38163
Build 35052: arc lint + arc unit

Event Timeline

sys/vm/uma_core.c
3682

We should fall back to looking for free slabs in other domains in this case.

Handle M_NOVM by falling back to other domains, just as we would for
a slab allocation failure.

This needs more work. It's ok for first-touch zones, which is basically everything today. We only use the round-robin policy for cache zones, which don't have a keg. However, keg_first_slab() is quite broken for the round-robin case since we split the keg lock into per-domain locks.

mav added inline comments.
sys/vm/uma_core.c
2252

I don't see DOMAINSET_FT() in head. Is it separate review?

sys/vm/uma_core.c
2252

It's in the parent revision, D29104.