Page MenuHomeFreeBSD

vm: stop trylocking pagequeues in vm_page_pqbatch_submit
ClosedPublic

Authored by mjg on Oct 7 2019, 9:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 27 2024, 3:36 PM
Unknown Object (File)
Sep 27 2024, 7:06 AM
Unknown Object (File)
Sep 21 2024, 12:04 AM
Unknown Object (File)
Sep 15 2024, 6:38 PM
Unknown Object (File)
Sep 8 2024, 5:14 PM
Unknown Object (File)
Sep 5 2024, 6:34 PM
Unknown Object (File)
Sep 1 2024, 1:26 PM
Unknown Object (File)
Aug 31 2024, 8:48 PM
Subscribers

Details

Summary

About 11 minutes of poudriere -s -j 104 and probing on return vlaue of trylocks reveals:

kernel`vm_page_pqbatch_submit                       _mtx_trylock_flags_int                                            0          5598217
kernel`vm_page_pqbatch_submit                       _mtx_trylock_flags_int                                            1         41540482

That is, over 10% of all trylocks here fail. This means there is an atomic op performed for trylock itself and then when attempting to actually lock which in turn slows down other threads. I did not bother measuring perf change, these lock are not /that/ contended yet.

I presume trylocking is there to make it more likely we operate on the same queue, but likelihood of this happening should not meaningfully change with this patch. Worst case we can steal the queue before taking the lock, but I don't think that wins anything of significance.

This makes vm_pagequeue_trylock unused in the tree, but I did not remove it just in case.

Diff Detail

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

Event Timeline

mjg edited the summary of this revision. (Show Details)

I was also trying to avoid an extra critical_exit() call and dpcpu reference.

This revision is now accepted and ready to land.Oct 7 2019, 10:14 PM