Page MenuHomeFreeBSD

Correct use of UMA_ZONE_VM
ClosedPublic

Authored by jeff on Feb 16 2020, 9:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 9, 12:49 PM
Unknown Object (File)
Feb 9 2024, 2:20 AM
Unknown Object (File)
Jan 12 2024, 8:18 PM
Unknown Object (File)
Dec 20 2023, 7:16 AM
Unknown Object (File)
Nov 22 2023, 8:17 PM
Unknown Object (File)
Nov 22 2023, 6:45 PM
Unknown Object (File)
Nov 22 2023, 6:45 PM
Unknown Object (File)
Nov 22 2023, 6:30 PM
Subscribers

Details

Summary

UMA_ZONE_VM is only for consumers that are involved in the KVA or page allocation path. Setting this restricts layout and prevents the allocation of pages for buckets. It should be used sparingly. It really doesn't have anything to do with low memory handling. If we're low on pages we already will avoid allocating buckets for any zone.

I would actually like it if all zones were able to allocate buckets from pages. It is almost safe on radix for direct map architectures. I may need a per-thread recursion flag to resolve that.

Test Plan

stress2 on amd64. I have asked pho to run on 32bit.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jeff edited the test plan for this revision. (Show Details)
jeff added reviewers: kib, markj, rlibby.
jeff set the repository for this revision to rS FreeBSD src repository - subversion.
sys/kern/subr_vmem.c
565 ↗(On Diff #68397)

We don't use this for kernel_vmem

674 ↗(On Diff #68397)

I don't know why this was nofree. We have an allocator that works.

sys/kern/vfs_subr.c
674 ↗(On Diff #68397)

This is nofree for ugly reasons but it does not need to be ZONE_VM.

sys/vm/vm_page.c
1981 ↗(On Diff #68397)

I like this being more explicitly associated with the zalloc. This allows me to loosen the definition of ZONE_VM without making the page cache recurse into itself.

markj added inline comments.
sys/kern/vfs_subr.c
674 ↗(On Diff #68397)

Could you add a comment explaining the nofree? I presume it's to ensure that the preallocation doesn't get reclaimed, but I'm not sure.

This revision is now accepted and ready to land.Feb 17 2020, 2:22 PM

I have tested this off and on for several days without issue.

sys/kern/vfs_subr.c
674 ↗(On Diff #68397)

There is a comment above uma_zcreate() that describes it already.

  • Preallocate enough nodes to support one-per buf so that
  • we can not fail an insert. reassignbuf() callers can not
  • tolerate the insertion failure.

We bdirty()/bundirty() in bufdone() which is an ithread. You would have to do something like pmap does to reclaim pv entries if you really wanted this to work. Since the preallocation happens at boot it's not really contributing to fragmentation. It is unfortunate but we also limit the buf zone to a fraction of memory so it's not as bad as the radix for pages.

sys/kern/vfs_subr.c
674 ↗(On Diff #68397)

I just mean that that comment doesn't directly explain why it's nofree. It looks like it's referring to the uma_prealloc() call. Someone might presume that we also rely on type-stability of the trie nodes somewhere.