Page MenuHomeFreeBSD

Set moea64_bpvo_pool_size based on physical memory
ClosedPublic

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

Details

Summary

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 https://reviews.freebsd.org/rS358670 is necessary when stress testing.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

afscoelho_gmail.com 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.

sys/powerpc/aim/mmu_oea64.c
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.

sys/powerpc/aim/mmu_oea64.c
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.

sys/powerpc/aim/mmu_oea64.c
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)
    printf(".....\n");
sys/powerpc/aim/mmu_oea64.c
927 ↗(On Diff #69680)

Good idea, thanks.

sys/powerpc/aim/mmu_oea64.c
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.

sys/powerpc/aim/mmu_oea64.c
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.