€•ØŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ$/translations/zh_CN/locking/lockstat”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/zh_TW/locking/lockstat”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/it_IT/locking/lockstat”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/ja_JP/locking/lockstat”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/ko_KR/locking/lockstat”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/pt_BR/locking/lockstat”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/sp_SP/locking/lockstat”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒLock Statistics”h]”hŒLock Statistics”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ>/var/lib/git/docbuild/linux/Documentation/locking/lockstat.rst”h´Kubh¶)”}”(hhh]”(h»)”}”(hŒWhat”h]”hŒWhat”…””}”(hhÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhhËh²hh³hÊh´KubhŒ paragraph”“”)”}”(hŒ6As the name suggests, it provides statistics on locks.”h]”hŒ6As the name suggests, it provides statistics on locks.”…””}”(hhÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubeh}”(h]”Œwhat”ah ]”h"]”Œwhat”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒWhy”h]”hŒWhy”…””}”(hh÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhhôh²hh³hÊh´K ubhÝ)”}”(hŒDBecause things like lock contention can severely impact performance.”h]”hŒDBecause things like lock contention can severely impact performance.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khhôh²hubeh}”(h]”Œwhy”ah ]”h"]”Œwhy”ah$]”h&]”uh1hµhh·h²hh³hÊh´K ubh¶)”}”(hhh]”(h»)”}”(hŒHow”h]”hŒHow”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´KubhÝ)”}”(hŒ÷Lockdep already has hooks in the lock functions and maps lock instances to lock classes. We build on that (see Documentation/locking/lockdep-design.rst). The graph below shows the relation between the lock functions and the various hooks therein::”h]”hŒöLockdep already has hooks in the lock functions and maps lock instances to lock classes. We build on that (see Documentation/locking/lockdep-design.rst). The graph below shows the relation between the lock functions and the various hooks therein:”…””}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khjh²hubhŒ literal_block”“”)”}”(hX‘ __acquire | lock _____ | \ | __contended | | | | _______/ |/ | __acquired | . . | __release | unlock lock, unlock - the regular lock functions __* - the hooks <> - states”h]”hX‘ __acquire | lock _____ | \ | __contended | | | | _______/ |/ | __acquired | . . | __release | unlock lock, unlock - the regular lock functions __* - the hooks <> - states”…””}”hj<sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1j:h³hÊh´Khjh²hubhÝ)”}”(hŒ5With these hooks we provide the following statistics:”h]”hŒ5With these hooks we provide the following statistics:”…””}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K0hjh²hubhŒ block_quote”“”)”}”(hXêcon-bounces - number of lock contention that involved x-cpu data contentions - number of lock acquisitions that had to wait wait time min - shortest (non-0) time we ever had to wait for a lock max - longest time we ever had to wait for a lock total - total time we spend waiting on this lock avg - average time spent waiting on this lock acq-bounces - number of lock acquisitions that involved x-cpu data acquisitions - number of times we took the lock hold time min - shortest (non-0) time we ever held the lock max - longest time we ever held the lock total - total time this lock was held avg - average time this lock was held ”h]”hŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒ@con-bounces - number of lock contention that involved x-cpu data”h]”(hŒterm”“”)”}”(hŒ con-bounces”h]”hŒ con-bounces”…””}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´K2hjgubhŒ definition”“”)”}”(hhh]”hŒ bullet_list”“”)”}”(hhh]”hŒ list_item”“”)”}”(hŒ2number of lock contention that involved x-cpu data”h]”hÝ)”}”(hj‰h]”hŒ2number of lock contention that involved x-cpu data”…””}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj‡ubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hj‚ubah}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j€h³hÊh´K3hj}ubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hjgubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´K2hjbubjf)”}”(hŒ:contentions - number of lock acquisitions that had to wait”h]”(jl)”}”(hŒ contentions”h]”hŒ contentions”…””}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´K4hj²ubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ,number of lock acquisitions that had to wait”h]”hÝ)”}”(hjÌh]”hŒ,number of lock acquisitions that had to wait”…””}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K5hjÊubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hjÇubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´K5hjÄubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hj²ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´K4hjbubjf)”}”(hŒáwait time min - shortest (non-0) time we ever had to wait for a lock max - longest time we ever had to wait for a lock total - total time we spend waiting on this lock avg - average time spent waiting on this lock”h]”(jl)”}”(hŒ wait time”h]”hŒ wait time”…””}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´K=hjóubj|)”}”(hhh]”ja)”}”(hhh]”(jf)”}”(hŒ:min - shortest (non-0) time we ever had to wait for a lock”h]”(jl)”}”(hŒmin”h]”hŒmin”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´K7hj ubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ4shortest (non-0) time we ever had to wait for a lock”h]”hÝ)”}”(hj%h]”hŒ4shortest (non-0) time we ever had to wait for a lock”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K8hj#ubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hj ubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´K8hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´K7hjubjf)”}”(hŒ1max - longest time we ever had to wait for a lock”h]”(jl)”}”(hŒmax”h]”hŒmax”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´K9hjLubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ+longest time we ever had to wait for a lock”h]”hÝ)”}”(hjfh]”hŒ+longest time we ever had to wait for a lock”…””}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K:hjdubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hjaubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´K:hj^ubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hjLubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´K9hjubjf)”}”(hŒ0total - total time we spend waiting on this lock”h]”(jl)”}”(hŒtotal”h]”hŒtotal”…””}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´K;hjubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ(total time we spend waiting on this lock”h]”hÝ)”}”(hj§h]”hŒ(total time we spend waiting on this lock”…””}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khjæubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hjãubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´K>hjàubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hjÎubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´K=hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j`hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hjóubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´K=hjbubjf)”}”(hŒBacq-bounces - number of lock acquisitions that involved x-cpu data”h]”(jl)”}”(hŒ acq-bounces”h]”hŒ acq-bounces”…””}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´K?hj!ubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ4number of lock acquisitions that involved x-cpu data”h]”hÝ)”}”(hj;h]”hŒ4number of lock acquisitions that involved x-cpu data”…””}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K@hj9ubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hj6ubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´K@hj3ubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hj!ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´K?hjbubjf)”}”(hŒ/acquisitions - number of times we took the lock”h]”(jl)”}”(hŒ acquisitions”h]”hŒ acquisitions”…””}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´KAhjbubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ number of times we took the lock”h]”hÝ)”}”(hj|h]”hŒ number of times we took the lock”…””}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KBhjzubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hjwubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´KBhjtubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hjbubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´KAhjbubjf)”}”(hŒ½hold time min - shortest (non-0) time we ever held the lock max - longest time we ever held the lock total - total time this lock was held avg - average time this lock was held ”h]”(jl)”}”(hŒ hold time”h]”hŒ hold time”…””}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´KKhj£ubj|)”}”(hhh]”ja)”}”(hhh]”(jf)”}”(hŒ1min - shortest (non-0) time we ever held the lock”h]”(jl)”}”(hŒmin”h]”hŒmin”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´KDhj»ubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ+shortest (non-0) time we ever held the lock”h]”hÝ)”}”(hjÕh]”hŒ+shortest (non-0) time we ever held the lock”…””}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KEhjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hjÐubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´KEhjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hj»ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´KDhj¸ubjf)”}”(hŒ(max - longest time we ever held the lock”h]”(jl)”}”(hŒmax”h]”hŒmax”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´KFhjüubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ"longest time we ever held the lock”h]”hÝ)”}”(hjh]”hŒ"longest time we ever held the lock”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KGhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hjubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´KGhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hjüubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´KFhj¸ubjf)”}”(hŒ%total - total time this lock was held”h]”(jl)”}”(hŒtotal”h]”hŒtotal”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´KHhj=ubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒtotal time this lock was held”h]”hÝ)”}”(hjWh]”hŒtotal time this lock was held”…””}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KIhjUubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hjRubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´KIhjOubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hj=ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´KHhj¸ubjf)”}”(hŒ&avg - average time this lock was held ”h]”(jl)”}”(hŒavg”h]”hŒavg”…””}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jkh³hÊh´KKhj~ubj|)”}”(hhh]”j)”}”(hhh]”j†)”}”(hŒ average time this lock was held ”h]”hÝ)”}”(hŒaverage time this lock was held”h]”hŒaverage time this lock was held”…””}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KKhj–ubah}”(h]”h ]”h"]”h$]”h&]”uh1j…hj“ubah}”(h]”h ]”h"]”h$]”h&]”j¤j¥uh1j€h³hÊh´KKhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hj~ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´KKhj¸ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j`hjµubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hj£ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jeh³hÊh´KKhjbubeh}”(h]”h ]”h"]”h$]”h&]”uh1j`hj\ubah}”(h]”h ]”h"]”h$]”h&]”uh1jZh³hÊh´K2hjh²hubhÝ)”}”(hŒRThese numbers are gathered per lock class, per read/write state (when applicable).”h]”hŒRThese numbers are gathered per lock class, per read/write state (when applicable).”…””}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KMhjh²hubhÝ)”}”(hŒuIt also tracks 4 contention points per class. A contention point is a call site that had to wait on lock acquisition.”h]”hŒuIt also tracks 4 contention points per class. A contention point is a call site that had to wait on lock acquisition.”…””}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KPhjh²hubh¶)”}”(hhh]”(h»)”}”(hŒ Configuration”h]”hŒ Configuration”…””}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjúh²hh³hÊh´KTubhÝ)”}”(hŒ1Lock statistics are enabled via CONFIG_LOCK_STAT.”h]”hŒ1Lock statistics are enabled via CONFIG_LOCK_STAT.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KVhjúh²hubeh}”(h]”Œ configuration”ah ]”h"]”Œ configuration”ah$]”h&]”uh1hµhjh²hh³hÊh´KTubh¶)”}”(hhh]”(h»)”}”(hŒUsage”h]”hŒUsage”…””}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj!h²hh³hÊh´KYubhÝ)”}”(hŒ!Enable collection of statistics::”h]”hŒ Enable collection of statistics:”…””}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K[hj!h²hubj;)”}”(hŒ$# echo 1 >/proc/sys/kernel/lock_stat”h]”hŒ$# echo 1 >/proc/sys/kernel/lock_stat”…””}”hj@sbah}”(h]”h ]”h"]”h$]”h&]”jJjKuh1j:h³hÊh´K]hj!h²hubhÝ)”}”(hŒ"Disable collection of statistics::”h]”hŒ!Disable collection of statistics:”…””}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K_hj!h²hubj;)”}”(hŒ$# echo 0 >/proc/sys/kernel/lock_stat”h]”hŒ$# echo 0 >/proc/sys/kernel/lock_stat”…””}”hj\sbah}”(h]”h ]”h"]”h$]”h&]”jJjKuh1j:h³hÊh´Kahj!h²hubhÝ)”}”(hŒ%Look at the current lock statistics::”h]”hŒ$Look at the current lock statistics:”…””}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kchj!h²hubj;)”}”(hX}( line numbers not part of actual output, done for clarity in the explanation below ) # less /proc/lock_stat 01 lock_stat version 0.4 02----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 03 class name con-bounces contentions waittime-min waittime-max waittime-total waittime-avg acq-bounces acquisitions holdtime-min holdtime-max holdtime-total holdtime-avg 04----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 05 06 &mm->mmap_sem-W: 46 84 0.26 939.10 16371.53 194.90 47291 2922365 0.16 2220301.69 17464026916.32 5975.99 07 &mm->mmap_sem-R: 37 100 1.31 299502.61 325629.52 3256.30 212344 34316685 0.10 7744.91 95016910.20 2.77 08 --------------- 09 &mm->mmap_sem 1 [] khugepaged_scan_mm_slot+0x57/0x280 10 &mm->mmap_sem 96 [] __do_page_fault+0x1d4/0x510 11 &mm->mmap_sem 34 [] vm_mmap_pgoff+0x87/0xd0 12 &mm->mmap_sem 17 [] vm_munmap+0x41/0x80 13 --------------- 14 &mm->mmap_sem 1 [] dup_mmap+0x2a/0x3f0 15 &mm->mmap_sem 60 [] SyS_mprotect+0xe9/0x250 16 &mm->mmap_sem 41 [] __do_page_fault+0x1d4/0x510 17 &mm->mmap_sem 68 [] vm_mmap_pgoff+0x87/0xd0 18 19............................................................................................................................................................................................................................. 20 21 unix_table_lock: 110 112 0.21 49.24 163.91 1.46 21094 66312 0.12 624.42 31589.81 0.48 22 --------------- 23 unix_table_lock 45 [] unix_create1+0x16e/0x1b0 24 unix_table_lock 47 [] unix_release_sock+0x31/0x250 25 unix_table_lock 15 [] unix_find_other+0x117/0x230 26 unix_table_lock 5 [] unix_autobind+0x11f/0x1b0 27 --------------- 28 unix_table_lock 39 [] unix_release_sock+0x31/0x250 29 unix_table_lock 49 [] unix_create1+0x16e/0x1b0 30 unix_table_lock 20 [] unix_find_other+0x117/0x230 31 unix_table_lock 4 [] unix_autobind+0x11f/0x1b0”h]”hX}( line numbers not part of actual output, done for clarity in the explanation below ) # less /proc/lock_stat 01 lock_stat version 0.4 02----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 03 class name con-bounces contentions waittime-min waittime-max waittime-total waittime-avg acq-bounces acquisitions holdtime-min holdtime-max holdtime-total holdtime-avg 04----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 05 06 &mm->mmap_sem-W: 46 84 0.26 939.10 16371.53 194.90 47291 2922365 0.16 2220301.69 17464026916.32 5975.99 07 &mm->mmap_sem-R: 37 100 1.31 299502.61 325629.52 3256.30 212344 34316685 0.10 7744.91 95016910.20 2.77 08 --------------- 09 &mm->mmap_sem 1 [] khugepaged_scan_mm_slot+0x57/0x280 10 &mm->mmap_sem 96 [] __do_page_fault+0x1d4/0x510 11 &mm->mmap_sem 34 [] vm_mmap_pgoff+0x87/0xd0 12 &mm->mmap_sem 17 [] vm_munmap+0x41/0x80 13 --------------- 14 &mm->mmap_sem 1 [] dup_mmap+0x2a/0x3f0 15 &mm->mmap_sem 60 [] SyS_mprotect+0xe9/0x250 16 &mm->mmap_sem 41 [] __do_page_fault+0x1d4/0x510 17 &mm->mmap_sem 68 [] vm_mmap_pgoff+0x87/0xd0 18 19............................................................................................................................................................................................................................. 20 21 unix_table_lock: 110 112 0.21 49.24 163.91 1.46 21094 66312 0.12 624.42 31589.81 0.48 22 --------------- 23 unix_table_lock 45 [] unix_create1+0x16e/0x1b0 24 unix_table_lock 47 [] unix_release_sock+0x31/0x250 25 unix_table_lock 15 [] unix_find_other+0x117/0x230 26 unix_table_lock 5 [] unix_autobind+0x11f/0x1b0 27 --------------- 28 unix_table_lock 39 [] unix_release_sock+0x31/0x250 29 unix_table_lock 49 [] unix_create1+0x16e/0x1b0 30 unix_table_lock 20 [] unix_find_other+0x117/0x230 31 unix_table_lock 4 [] unix_autobind+0x11f/0x1b0”…””}”hjxsbah}”(h]”h ]”h"]”h$]”h&]”jJjKuh1j:h³hÊh´Kehj!h²hubhÝ)”}”(hXrThis excerpt shows the first two lock class statistics. Line 01 shows the output version - each time the format changes this will be updated. Line 02-04 show the header with column descriptions. Lines 05-18 and 20-31 show the actual statistics. These statistics come in two parts; the actual stats separated by a short separator (line 08, 13) from the contention points.”h]”hXrThis excerpt shows the first two lock class statistics. Line 01 shows the output version - each time the format changes this will be updated. Line 02-04 show the header with column descriptions. Lines 05-18 and 20-31 show the actual statistics. These statistics come in two parts; the actual stats separated by a short separator (line 08, 13) from the contention points.”…””}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K‹hj!h²hubhÝ)”}”(hŒøLines 09-12 show the first 4 recorded contention points (the code which tries to get the lock) and lines 14-17 show the first 4 recorded contended points (the lock holder). It is possible that the max con-bounces point is missing in the statistics.”h]”hŒøLines 09-12 show the first 4 recorded contention points (the code which tries to get the lock) and lines 14-17 show the first 4 recorded contended points (the lock holder). It is possible that the max con-bounces point is missing in the statistics.”…””}”(hj”h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K‘hj!h²hubhÝ)”}”(hX The first lock (05-18) is a read/write lock, and shows two lines above the short separator. The contention points don't match the column descriptors, they have two: contentions and [] symbol. The second set of contention points are the points we're contending with.”h]”hXThe first lock (05-18) is a read/write lock, and shows two lines above the short separator. The contention points don’t match the column descriptors, they have two: contentions and [] symbol. The second set of contention points are the points we’re contending with.”…””}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K–hj!h²hubhÝ)”}”(hŒ-The integer part of the time values is in us.”h]”hŒ-The integer part of the time values is in us.”…””}”(hj°h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K›hj!h²hubhÝ)”}”(hŒ2Dealing with nested locks, subclasses may appear::”h]”hŒ1Dealing with nested locks, subclasses may appear:”…””}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khj!h²hubj;)”}”(hXÏ 32........................................................................................................................................................................................................................... 33 34 &rq->lock: 13128 13128 0.43 190.53 103881.26 7.91 97454 3453404 0.00 401.11 13224683.11 3.82 35 --------- 36 &rq->lock 645 [] task_rq_lock+0x43/0x75 37 &rq->lock 297 [] try_to_wake_up+0x127/0x25a 38 &rq->lock 360 [] select_task_rq_fair+0x1f0/0x74a 39 &rq->lock 428 [] scheduler_tick+0x46/0x1fb 40 --------- 41 &rq->lock 77 [] task_rq_lock+0x43/0x75 42 &rq->lock 174 [] try_to_wake_up+0x127/0x25a 43 &rq->lock 4715 [] double_rq_lock+0x42/0x54 44 &rq->lock 893 [] schedule+0x157/0x7b8 45 46........................................................................................................................................................................................................................... 47 48 &rq->lock/1: 1526 11488 0.33 388.73 136294.31 11.86 21461 38404 0.00 37.93 109388.53 2.84 49 ----------- 50 &rq->lock/1 11526 [] double_rq_lock+0x4f/0x54 51 ----------- 52 &rq->lock/1 5645 [] double_rq_lock+0x42/0x54 53 &rq->lock/1 1224 [] schedule+0x157/0x7b8 54 &rq->lock/1 4336 [] double_rq_lock+0x4f/0x54 55 &rq->lock/1 181 [] try_to_wake_up+0x127/0x25a”h]”hXÏ 32........................................................................................................................................................................................................................... 33 34 &rq->lock: 13128 13128 0.43 190.53 103881.26 7.91 97454 3453404 0.00 401.11 13224683.11 3.82 35 --------- 36 &rq->lock 645 [] task_rq_lock+0x43/0x75 37 &rq->lock 297 [] try_to_wake_up+0x127/0x25a 38 &rq->lock 360 [] select_task_rq_fair+0x1f0/0x74a 39 &rq->lock 428 [] scheduler_tick+0x46/0x1fb 40 --------- 41 &rq->lock 77 [] task_rq_lock+0x43/0x75 42 &rq->lock 174 [] try_to_wake_up+0x127/0x25a 43 &rq->lock 4715 [] double_rq_lock+0x42/0x54 44 &rq->lock 893 [] schedule+0x157/0x7b8 45 46........................................................................................................................................................................................................................... 47 48 &rq->lock/1: 1526 11488 0.33 388.73 136294.31 11.86 21461 38404 0.00 37.93 109388.53 2.84 49 ----------- 50 &rq->lock/1 11526 [] double_rq_lock+0x4f/0x54 51 ----------- 52 &rq->lock/1 5645 [] double_rq_lock+0x42/0x54 53 &rq->lock/1 1224 [] schedule+0x157/0x7b8 54 &rq->lock/1 4336 [] double_rq_lock+0x4f/0x54 55 &rq->lock/1 181 [] try_to_wake_up+0x127/0x25a”…””}”hjÌsbah}”(h]”h ]”h"]”h$]”h&]”jJjKuh1j:h³hÊh´KŸhj!h²hubhÝ)”}”(hŒÌLine 48 shows statistics for the second subclass (/1) of &rq->lock class (subclass starts from 0), since in this case, as line 50 suggests, double_rq_lock actually acquires a nested lock of two spinlocks.”h]”hŒÌLine 48 shows statistics for the second subclass (/1) of &rq->lock class (subclass starts from 0), since in this case, as line 50 suggests, double_rq_lock actually acquires a nested lock of two spinlocks.”…””}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K¸hj!h²hubhÝ)”}”(hŒView the top contending locks::”h]”hŒView the top contending locks:”…””}”(hjèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K¼hj!h²hubj;)”}”(hX­# grep : /proc/lock_stat | head clockevents_lock: 2926159 2947636 0.15 46882.81 1784540466.34 605.41 3381345 3879161 0.00 2260.97 53178395.68 13.71 tick_broadcast_lock: 346460 346717 0.18 2257.43 39364622.71 113.54 3642919 4242696 0.00 2263.79 49173646.60 11.59 &mapping->i_mmap_mutex: 203896 203899 3.36 645530.05 31767507988.39 155800.21 3361776 8893984 0.17 2254.15 14110121.02 1.59 &rq->lock: 135014 136909 0.18 606.09 842160.68 6.15 1540728 10436146 0.00 728.72 17606683.41 1.69 &(&zone->lru_lock)->rlock: 93000 94934 0.16 59.18 188253.78 1.98 1199912 3809894 0.15 391.40 3559518.81 0.93 tasklist_lock-W: 40667 41130 0.23 1189.42 428980.51 10.43 270278 510106 0.16 653.51 3939674.91 7.72 tasklist_lock-R: 21298 21305 0.20 1310.05 215511.12 10.12 186204 241258 0.14 1162.33 1179779.23 4.89 rcu_node_1: 47656 49022 0.16 635.41 193616.41 3.95 844888 1865423 0.00 764.26 1656226.96 0.89 &(&dentry->d_lockref.lock)->rlock: 39791 40179 0.15 1302.08 88851.96 2.21 2790851 12527025 0.10 1910.75 3379714.27 0.27 rcu_node_0: 29203 30064 0.16 786.55 1555573.00 51.74 88963 244254 0.00 398.87 428872.51 1.76”h]”hX­# grep : /proc/lock_stat | head clockevents_lock: 2926159 2947636 0.15 46882.81 1784540466.34 605.41 3381345 3879161 0.00 2260.97 53178395.68 13.71 tick_broadcast_lock: 346460 346717 0.18 2257.43 39364622.71 113.54 3642919 4242696 0.00 2263.79 49173646.60 11.59 &mapping->i_mmap_mutex: 203896 203899 3.36 645530.05 31767507988.39 155800.21 3361776 8893984 0.17 2254.15 14110121.02 1.59 &rq->lock: 135014 136909 0.18 606.09 842160.68 6.15 1540728 10436146 0.00 728.72 17606683.41 1.69 &(&zone->lru_lock)->rlock: 93000 94934 0.16 59.18 188253.78 1.98 1199912 3809894 0.15 391.40 3559518.81 0.93 tasklist_lock-W: 40667 41130 0.23 1189.42 428980.51 10.43 270278 510106 0.16 653.51 3939674.91 7.72 tasklist_lock-R: 21298 21305 0.20 1310.05 215511.12 10.12 186204 241258 0.14 1162.33 1179779.23 4.89 rcu_node_1: 47656 49022 0.16 635.41 193616.41 3.95 844888 1865423 0.00 764.26 1656226.96 0.89 &(&dentry->d_lockref.lock)->rlock: 39791 40179 0.15 1302.08 88851.96 2.21 2790851 12527025 0.10 1910.75 3379714.27 0.27 rcu_node_0: 29203 30064 0.16 786.55 1555573.00 51.74 88963 244254 0.00 398.87 428872.51 1.76”…””}”hjösbah}”(h]”h ]”h"]”h$]”h&]”jJjKuh1j:h³hÊh´K¾hj!h²hubhÝ)”}”(hŒClear the statistics::”h]”hŒClear the statistics:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KÊhj!h²hubj;)”}”(hŒ# echo 0 > /proc/lock_stat”h]”hŒ# echo 0 > /proc/lock_stat”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jJjKuh1j:h³hÊh´KÌhj!h²hubeh}”(h]”Œusage”ah ]”h"]”Œusage”ah$]”h&]”uh1hµhjh²hh³hÊh´KYubeh}”(h]”Œhow”ah ]”h"]”Œhow”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubeh}”(h]”Œlock-statistics”ah ]”h"]”Œlock statistics”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j[Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j5j2hñhîjjj-j*jjj%j"uŒ nametypes”}”(j5‰hñ‰j‰j-‰j‰j%‰uh}”(j2h·hîhËjhôj*jjjúj"j!uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.