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)
Jan 25 2024, 4:46 AM
Unknown Object (File)
Jan 25 2024, 4:46 AM
Unknown Object (File)
Jan 25 2024, 4:46 AM
Unknown Object (File)
Jan 25 2024, 4:46 AM
Unknown Object (File)
Jan 25 2024, 4:31 AM
Unknown Object (File)
Jan 12 2024, 1:00 AM
Unknown Object (File)
Dec 20 2023, 9:21 PM
Unknown Object (File)
Oct 29 2023, 2:36 PM
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.