Page MenuHomeFreeBSD

Speed up vm_page_array initialization.
ClosedPublic

Authored by markj on Sep 6 2017, 6:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 13, 3:24 AM
Unknown Object (File)
Sun, Oct 12, 2:01 AM
Unknown Object (File)
Sat, Oct 4, 12:11 AM
Unknown Object (File)
Fri, Oct 3, 9:14 PM
Unknown Object (File)
Thu, Oct 2, 9:14 PM
Unknown Object (File)
Thu, Oct 2, 12:49 PM
Unknown Object (File)
Thu, Oct 2, 8:33 AM
Unknown Object (File)
Thu, Oct 2, 6:48 AM
Subscribers

Details

Summary

Collapse 3 loops over the vm_page array into 1 following a suggestion
from alc@. Testing on EC2 and a few desktop CPUs (Intel and AMD) shows
a significant improvement in initialization time.

One exception is pig1 in the netperf cluster, which contains Westmere-EX
CPUs. This patch makes vm_page_array initialization about 10% slower
there. I still haven't figured out how to address that; some
experimentation showed that zeroing vm_pages in a stride less than the
L1 cache size gives a good improvement, but this depends on the
alignment of the strides: my initial patch didn't align them, but when I
aligned them to the cache line size, the initialization slowed down
again.

I managed to reproduce what I think is the same problem using a userland
program, but the issue is difficult to analyze since many of the PMCs
I've tried to use don't appear to work (pmcstat returns EINVAL upon
attempting to enable them). I haven't yet dug into this further.

However, since the patch is straightforward and gives a good
improvement for cperciva's case, I'd like to propose its inclusion now.

Diff Detail

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

Event Timeline

sys/vm/vm_page.c
625 โ†—(On Diff #32727)

For stylistic consistency, we should probably have a blank line here, i.e., before the #if/block comment.

667 โ†—(On Diff #32727)

I would suggest adding a comment explaining our assumptions about phys_avail[]. Essentially, what you wrote in an earlier email.

  • Adress review feedback.
This revision is now accepted and ready to land.Sep 7 2017, 4:58 PM
This revision was automatically updated to reflect the committed changes.