Page MenuHomeFreeBSD

Optimize reserve_pv_entries() in sys/amd64/amd64/pmap.c
ClosedPublic

Authored by jkim on May 24 2016, 7:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jun 28 2025, 11:32 AM
Unknown Object (File)
Jun 27 2025, 3:05 PM
Unknown Object (File)
May 25 2025, 11:28 AM
Unknown Object (File)
May 23 2025, 10:09 PM
Unknown Object (File)
May 10 2025, 11:10 PM
Unknown Object (File)
Apr 29 2025, 7:53 PM
Unknown Object (File)
Apr 12 2025, 8:20 AM
Unknown Object (File)
Mar 13 2025, 2:33 PM
Subscribers

Details

Summary

As alc pointed out, Clang does not generate optimal popcnt_pc_map_elem_pq().

http://docs.freebsd.org/cgi/mid.cgi?552BFEB2.8040407

I tried many implementations but I was not able to generate optimal code for both Clang and GCC. This patch just implements it in inline assembly without loop or unrolled loop. Also, newly added bit_count() is used instead of bitcount64() for the non-POPCNT case.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jkim retitled this revision from to Optimize reserve_pv_entries() in sys/amd64/amd64/pmap.c.
jkim updated this object.
jkim edited the test plan for this revision. (Show Details)
jkim added reviewers: alc, jhb, kib.
jkim set the repository for this revision to rS FreeBSD src repository - subversion.
kib edited edge metadata.
This revision is now accepted and ready to land.May 24 2016, 8:09 PM
sys/amd64/amd64/pmap.c
3150 ↗(On Diff #16815)

Since this function assumes a certain map size, I'd suggest adding a CTASSERT to that effect, so that a map size change would be detected at compile time.

alc edited edge metadata.

There is already a CTASSERT elsewhere.

This revision was automatically updated to reflect the committed changes.