Page MenuHomeFreeBSD

Better boot_pages autotuning.
ClosedPublic

Authored by glebius on Jan 25 2018, 10:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 6:12 AM
Unknown Object (File)
Feb 19 2024, 11:52 AM
Unknown Object (File)
Feb 11 2024, 10:32 PM
Unknown Object (File)
Dec 30 2023, 10:10 PM
Unknown Object (File)
Dec 29 2023, 7:35 PM
Unknown Object (File)
Dec 3 2023, 11:03 AM
Unknown Object (File)
Nov 11 2023, 9:20 PM
Unknown Object (File)
Nov 9 2023, 9:19 PM
Subscribers

Details

Summary

Followup on r302393 by cperciva. Always calculate amount of pages that
are required to allocate UMA zones, not only if size of a zone is larger
than page size.

  • Introduce another stage of UMA startup, which is entered after vm_page_startup() finishes. After this stage we don't yet enable buckets, but we can ask VM for pages. Rename stages to meaningful names while here. New list of stages: BOOT_COLD, BOOT_STRAPPED, BOOT_PAGEALLOC, BOOT_BUCKETS, BOOT_RUNNING. Enabling page alloc earlier, allows us to dramatically reduce number of boot page allocation. What is more important it becomes consistent across different machines. Now only UMA internal zones actually need to use startup_alloc().
  • Introduce uma_startup_count() function, to avoid code duplication. It calculates sizes of zone zone and keg zone, and calculates how many pages UMA need to bootstrap. Keep count not only of zone structures, but also of kegs, slabs and hashes. Remove the hardcoded vm.boot_pages completely.
  • Hide uma_startup_foo() declarations from public file.
  • Provide several DIAGNOSTIC printfs on boot_pages use.
  • Bugfix: when calculating zone of zones size use (mp_maxid + 1) instead of mp_ncpus. Use resulting number not only in the size argument to zone_ctor() but also as args.size.

Diff Detail

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

Event Timeline

This looks fairly sane to me. I see no craziness, except maybe the last += 4. And even that seems sane.

This revision is now accepted and ready to land.Jan 25 2018, 10:28 PM
sys/vm/vm_page.c
541 ↗(On Diff #38463)

Which pmap ?

Are you sure that non-x86 pmaps are limited to one allocation during pmap_init() ?

sys/vm/vm_page.c
541 ↗(On Diff #38463)

amd64. Not sure, that's why posted the review :) I will review other arches and followup.

A bigger approach to boot_pages management. The most important
change is that we actually can ask VM for pages much earlier
than we do now right after vm_page_startup(), thus do so.

o Introduce another stage of UMA startup, which is entered

after vm_page_startup() finishes. After this stage we don't
yet enable buckets, but we can ask VM for pages. Rename
stages to meaningful names while here. New list of stages:
BOOT_COLD, BOOT_STRAPPED, BOOT_PAGEALLOC, BOOT_BUCKETS,
BOOT_RUNNING.

o Enabling page alloc earlier, allows us to dramatically reduce

number of boot page allocation. What is more important it becomes
consistent across different machines. Now only UMA internal zones
actually need to use startup_alloc().

o Hide uma_startup_foo() declarations from public file.
o Introduce uma_startup_count() function, to avoid code duplication.

It calculates sizes of zone zone and keg zone, and calculates
how many pages UMA need to bootstrap.

o Provide several DIAGNOSTIC printfs on boot_pages use.
o Bugfix: when calculating zone of zones size use (mp_maxid + 1)

instead of mp_ncpus. Use resulting number not only in the size
argument to zone_ctor() but also as args.size.
This revision now requires review to proceed.Jan 31 2018, 6:51 PM
glebius edited the summary of this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Feb 6 2018, 4:16 AM
This revision was automatically updated to reflect the committed changes.