Page MenuHomeFreeBSD

Set moea64_bpvo_pool_size based on physical memory

Authored by on Mar 17 2020, 5:53 PM.



Currently moea64_bpvo_pool_size has a hard coded value of 327680 which is insufficient for initial memory mapping at boot time on systems with, for example, 64G and no huge pages enabled. This patch sets moea64_bpvo_pool_size value based on physical memory plus an expansion factor.
The value estimation for moea64_bpvo_pool_size uses the physical memory and page size as input:

pages = physmem / PAGE_SIZE;
size = pages * sizeof(vm_page);
moea64_bpvo_pool_size = size / PAGE_SIZE * BPVO_POOL_EXPANSION_FACTOR;

Test Plan

For tests, use tool "stress" to allocate memory and see if no panic "bpvo pool exhausted" is raised.
Patch is necessary when stress testing.

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline edited the test plan for this revision. (Show Details)

Adjust moea64_bpvo_pool_size value only if hw_direct_map is false, otherwise set it to previous hard-coded value.

920 ↗(On Diff #69659)

This needs to be a '== 0', since moea64_bpvo_pool_size is an integer used as an integer, not a boolean.

925 ↗(On Diff #69659)

I'd make the 327680 a #define, commented that it's a sane historical default.

922 ↗(On Diff #69659)

It seems you are indenting with 2 spaces, but tabs should be used instead, except when you wrap long statements (as in the line below), then you should add 4 spaces.
Check style(9).

Style (indentation, comparison) fixes.

927 ↗(On Diff #69680)

I think would be good print a message containing pool size and memory used by this pool when kernel boots is in verbose mode (boot -v).
Something like:

if (bootverbose)
927 ↗(On Diff #69680)

Good idea, thanks.

927 ↗(On Diff #69680)

It looks like it's not possible to use 'bootverbose' at this stage of the boot. This variable is set later by init_main.c:129.

927 ↗(On Diff #69680)

(boothowto & RB_VERBOSE) does the same thing, and should be available almost immediately.

Print information message about number of bpvo pool entries and memory used by this pool when booting in verbose mode.

This revision is now accepted and ready to land.Apr 1 2020, 6:43 PM
This revision was automatically updated to reflect the committed changes.