This code path can be triggered by applying MADV_WILLNEED to a 1GB
mapping.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sys/amd64/amd64/pmap.c | ||
---|---|---|
7567–7569 | In the newly introduced if statement above, we already know whether pde is not NULL, but I'm pretty sure that the compiler can't infer that pmap_pdpe_to_pde(pdpe, va) cannot be NULL. For example, it doesn't know that physical page 0 is not allocatable. So, you could fold this if/else statement into the above and thereby eliminate the pde NULL check. The PHYS_TO_VM_PAGE line might be the only one that crosses 80 characters. |
sys/amd64/amd64/pmap.c | ||
---|---|---|
7567–7569 | I rewrote this fragment to avoid needless comparisons, but I can't see a way to do so that doesn't require adding either some code duplication or an ugly goto. |
Shouldn't the same change be made on arm64?
sys/amd64/amd64/pmap.c | ||
---|---|---|
7567–7569 | In this case, I would expect the compiler to be able to deduplicate the generated code with no extra branches. |
Yes, I simply haven't tested my arm64 patch yet.
As a side note, the existing regression tests for posix shared memory would have caught this if not for a bug in the test (largepage_madvise). :(