Page MenuHomeFreeBSD

Coalesce TLB shootdowns of global PTEs in pmap_advise().
ClosedPublic

Authored by markj on Jan 8 2017, 8:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 2, 10:03 PM
Unknown Object (File)
Thu, May 2, 10:03 PM
Unknown Object (File)
Thu, May 2, 10:03 PM
Unknown Object (File)
Thu, May 2, 9:11 PM
Unknown Object (File)
Thu, May 2, 8:35 PM
Unknown Object (File)
Apr 2 2024, 7:42 PM
Unknown Object (File)
Apr 2 2024, 5:58 PM
Unknown Object (File)
Mar 3 2024, 7:31 AM
Subscribers
None

Details

Summary

As of r311346, execve frequently calls pmap_advise() on multi-page
subranges of the kernel pmap. Right now, we invalidate consecutive entries
individually, resulting in more IPIs than necessary.

Diff Detail

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

Event Timeline

markj retitled this revision from to Coalesce TLB shootdowns of global PTEs in pmap_advise()..
markj edited the test plan for this revision. (Show Details)
markj updated this object.
markj added reviewers: alc, kib.
alc edited edge metadata.

The same change should apply to the i386 pmap.

This revision is now accepted and ready to land.Jan 8 2017, 10:43 PM

Why do we need to apply such great accuracy to the kernel pmap invalidation, while we do not care at all for the user pmaps ? What if you always set `anychanged``` if a pte was changed, and then at the end, near PMAP_UNLOCK(), do the pmap_invalidate_range() call if the var is true ?

In D9094#188033, @kib wrote:

Why do we need to apply such great accuracy to the kernel pmap invalidation, while we do not care at all for the user pmaps ? What if you always set anychanged if a pte was changed, and then at the end, near PMAP_UNLOCK(), do the pmap_invalidate_range() call if the var is true ?

Replying to myself, we must not invalidate unmapped ranges.

markj edited edge metadata.

Optimize i386 pmap_advise() as well.

This revision now requires review to proceed.Jan 10 2017, 4:29 AM
sys/amd64/amd64/pmap.c
6118 ↗(On Diff #23815)

In fact, returning to the merge of kernel_pmap and !kernel_pmap cases. After you added exact range invalidation, we still can remove anychanged and checks for PG_G. Always do range invalidation, regardless of the kernel/user pmap.

sys/amd64/amd64/pmap.c
6118 ↗(On Diff #23815)

I think that we should consider this issue separately. Right now, this revision follows the same approach as pmap_protect() and pmap_remove().

To be clear, I think that we should reconsider our utilization of range invalidations, or really lack thereof, on user-space pmaps. Things have changed, e.g., TLBs have gotten larger and we have made pmap_invalidate_all() work on the kernel pmap.

kib edited edge metadata.
kib added inline comments.
sys/amd64/amd64/pmap.c
6118 ↗(On Diff #23815)

I do not object.

Do you mean, by the second paragraph of your reply, that we should start doing range invalidations, or that instead, kernel range invalidations converted to _all() ?

This revision is now accepted and ready to land.Jan 10 2017, 4:15 PM
sys/amd64/amd64/pmap.c
6118 ↗(On Diff #23815)

Some of both.

This revision was automatically updated to reflect the committed changes.