Page MenuHomeFreeBSD

Remove page locking from pmap_mincore().
ClosedPublic

Authored by markj on Sep 27 2019, 4:30 PM.

Details

Summary

It is useless in mincore(2)'s default mode of operation. If we are in
the non-default mode, re-look up the page in the pmap after acquiring
the page's object lock.

Sprinkle some style fixes in vm_map_mincore(). If the approach is
acceptable, I will convert the other implementations of pmap_mincore()
and remove vm_page_pa_tryrelock().

Diff Detail

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

Event Timeline

markj created this revision.Sep 27 2019, 4:30 PM
markj updated this revision to Diff 62651.Sep 27 2019, 4:32 PM

Restore the original comment for the mincore_mapped case, I didn't
mean to rewrite it.

kib added a comment.Sep 29 2019, 2:18 PM

I think the approach of relying on the object lock is fine.

sys/vm/vm_mmap.c
882 ↗(On Diff #62651)

Where does this loop terminate if m->object == object and not NULL ?

markj updated this revision to Diff 62714.Sep 29 2019, 5:53 PM

kern_proc_vmmap_resident() requires an update as well.

kib accepted this revision.Sep 29 2019, 8:08 PM
This revision is now accepted and ready to land.Sep 29 2019, 8:08 PM
markj updated this revision to Diff 62731.Sep 30 2019, 1:32 AM
  • Convert other pmaps.
  • Remove vm_page_pa_tryrelock().
  • Initialize pa = 0. Some platforms do not implement pmap_mincore().
This revision now requires review to proceed.Sep 30 2019, 1:32 AM
alc added inline comments.Sep 30 2019, 2:49 AM
sys/vm/vm_mmap.c
798 ↗(On Diff #62731)

Shouldn't this be:

end = round_page(addr0 + len);
alc added inline comments.Sep 30 2019, 4:01 AM
sys/amd64/amd64/pmap.c
8407 ↗(On Diff #62731)

This is redundant.

markj marked an inline comment as done.Sep 30 2019, 3:33 PM
markj added inline comments.
sys/vm/vm_mmap.c
882 ↗(On Diff #62651)

I forgot to submit this comment apparently:

Sorry, I probably don't understand the question. The loop condition is m->object != object. object != NULL implies that object is write-locked, so if m->object == object the page identity cannot change.

798 ↗(On Diff #62731)

I think so.

markj updated this revision to Diff 62755.Sep 30 2019, 3:38 PM
  • Remove an unnecessary assignment in pmap_mincore().
  • Fix the calculation of end.
This revision was not accepted when it landed; it landed in state Needs Review.Oct 27 2019, 12:39 PM
This revision was automatically updated to reflect the committed changes.