Page MenuHomeFreeBSD

uma: Add UMA_ZONE_UNMANAGED
ClosedPublic

Authored by markj on Feb 2 2022, 7:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 4:17 AM
Unknown Object (File)
Sep 27 2024, 9:42 PM
Unknown Object (File)
Sep 23 2024, 2:51 PM
Unknown Object (File)
Sep 23 2024, 3:58 AM
Unknown Object (File)
Sep 22 2024, 8:16 PM
Unknown Object (File)
Sep 18 2024, 6:47 PM
Unknown Object (File)
Sep 16 2024, 12:51 AM
Unknown Object (File)
Sep 11 2024, 10:58 PM

Details

Summary

Allow a zone to opt out of cache size management. In particular,
uma_reclaim() and uma_reclaim_domain() will not reclaim any memory from
the zone, nor will uma_timeout() purge cached items if the zone is idle.
The consumer is responsible for doing so and probably ought to place a
limit on the zone size.

This effectively means that the zone consumer has control over when
items are reclaimed from the cache. In particular, uma_zone_reclaim()
will still reclaim cached items from an unmanaged zone.

Todo: man page update

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Feb 2 2022, 7:43 PM

Does zone destroy reclaims all free cached items?
What about allocated items at the zone destroy time?

This revision is now accepted and ready to land.Feb 3 2022, 10:39 AM
In D34142#772430, @kib wrote:

Does zone destroy reclaims all free cached items?

Yes. (But I did not specifically test this.)

What about allocated items at the zone destroy time?

They are leaked. Note that UMA won't tell you about it since this is a cache zone and it has no accounting for actual memory usage.

The alternative to this patch is to 1) change UMA to free cached items even from a _NOFREE zone in zone_dtor(), and 2) convert the mlx5 zones to regular _NOFREE zones which use custom a allocf routine to allocate slabs with the appropriate NUMA locality. Then use the zone's fini method to release HW resources. That may give better slab efficiency and would let the kernel at least reclaim buckets from the zone under memory pressure, and you'd get a printf() if items are leaked when a zone is destroyed. But I suspect _UNMANAGED is useful regardless, so I'd go with this patch unless there are objections.

I am trying to get a word from Hans about testing.

Initial test OK on top of FreeBSD-14 -current / main.

No panic at unload.

Going to leave the machine overnight.

1000 TLS TX send tags in use.

@kib : Can you port the mlx5 part of this patch internally?

WITNESS enabled.

Gonna leave the machine overnight.

All tests passed. @markj: Can you push this today?

This revision was automatically updated to reflect the committed changes.