Page MenuHomeFreeBSD

powerpc64/pmap: Simplify the code path for moea64_pte_replace_native()

Authored by jhibbits on Wed, Sep 4, 3:17 AM.



MOEA64_PTE_REPLACE() is called often with the pmap lock held, and
sometimes with the page pv lock held. The less work done while holding
a lock, the better. Since we are intending to replace the same PTE
(same hash index), we don't need to recalculate anything, just flat
replace the PTE. This cuts more than 200 instructions off the
invalidating code path. In addition, we don't need to replace a PTE
that's not occupied by this PVO.

Diff Detail

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

Event Timeline

jhibbits created this revision.Wed, Sep 4, 3:17 AM
luporl added a comment.EditedWed, Sep 4, 7:11 PM

I'm not that familiar with this code, but overall the change looks good and seem to preserve the behavior of previous version, except for the part in the following comment.

396–397 ↗(On Diff #61635)

This doesn't look correct.
In the old code moea64_pte_unset_native() would decrement moea64_pte_valid and moea64_pte_insert_native() would increment it again.
In this case, these two lines should be removed.

405 ↗(On Diff #61635)

It seems pt assignment can be moved to the if (flags == 0) { } block, to save a few more cycles.

jhibbits updated this revision to Diff 61665.Thu, Sep 5, 3:41 AM

Address luporl's comments.

luporl accepted this revision.Thu, Sep 5, 1:14 PM
This revision is now accepted and ready to land.Thu, Sep 5, 1:14 PM