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)
Sat, Apr 27, 2:35 AM
Unknown Object (File)
Dec 23 2023, 3:41 PM
Unknown Object (File)
Dec 20 2023, 1:25 AM
Unknown Object (File)
Oct 9 2023, 10:28 PM
Unknown Object (File)
May 22 2023, 2:13 PM
Unknown Object (File)
Jan 19 2023, 9:53 PM
Unknown Object (File)
Jan 2 2023, 8:18 AM
Unknown Object (File)
Dec 21 2022, 6:55 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