Page MenuHomeFreeBSD

pmap: Skip some superpage promotion attempts that will fail
ClosedPublic

Authored by alc on Fri, May 31, 10:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jun 4, 5:48 PM
Unknown Object (File)
Tue, Jun 4, 5:39 AM

Details

Summary

Implement a simple heuristic to skip pointless promotion attempts by
pmap_enter_quick_locked(). Specifically, when vm_fault() calls
pmap_enter_quick() to map neighboring pages at the end of a copy-on-
write fault, there is no point in attempting promotion in
pmap_enter_quick_locked(). Promotion will fail because the pages
have differing protection settings. The key change here is to pass
the same protection setting to pmap_enter_quick() that was previously
passed to pmap_enter(), so that pmap_enter_quick() can know whether
pmap_enter() created a mapping that allows write access.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

alc requested review of this revision.Fri, May 31, 10:51 PM
sys/vm/vm_fault.c
1956

Should setting of VM_PROT_NO_PROMOTE occur there and not in pmap_enter_quick? Right now it does not matter because pmap_enter_quick() is only called from there.
But if this changes some time in future, the method interface is becoming quite strange/unsafe (well, avoiding promotion without reason is not fatal).

alc marked an inline comment as done.Sun, Jun 2, 7:49 PM
alc added inline comments.
sys/vm/vm_fault.c
1956

I didn't want to pass unexpected arguments to other pmap implementations. For the most part, other pmap implementations don't attempt promotion from pmap_enter_quick(), so the new argument is moot. Only mmu_oea64 might promote from pmap_enter_quick(), so I've implemented support for the flag there.

alc marked an inline comment as done.

Set VM_PROT_NO_PROMOTE in vm_fault_prefault().

From a (very) quick check, it looks like the same change in amd64 should be made to mmu_radix for powerpc.

From a (very) quick check, it looks like the same change in amd64 should be made to mmu_radix for powerpc.

It doesn't apply because mmu_radix_enter_quick_locked() doesn't attempt promotion.

In D45431#1036871, @alc wrote:

From a (very) quick check, it looks like the same change in amd64 should be made to mmu_radix for powerpc.

It doesn't apply because mmu_radix_enter_quick_locked() doesn't attempt promotion.

Got it, thanks! I had just searched for a similar comment to what I saw in the amd64, and didn't go any further than that, but obviously I should have.

This revision is now accepted and ready to land.Mon, Jun 3, 7:51 AM

@jhibbits I would encourage you to apply https://reviews.freebsd.org/D40478 and a few other superpage-related follow on commits from amd64 to mmu_radix.c. This change would then apply to mmu_radix.c.

For some reason, this revision did not automatically close upon commit.