sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget$/translations/zh_CN/locking/lockstatmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/zh_TW/locking/lockstatmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/it_IT/locking/lockstatmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/ja_JP/locking/lockstatmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/ko_KR/locking/lockstatmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/sp_SP/locking/lockstatmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hLock Statisticsh]hLock Statistics}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh>/var/lib/git/docbuild/linux/Documentation/locking/lockstat.rsthKubh)}(hhh](h)}(hWhath]hWhat}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(h6As the name suggests, it provides statistics on locks.h]h6As the name suggests, it provides statistics on locks.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]whatah ]h"]whatah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hWhyh]hWhy}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hDBecause things like lock contention can severely impact performance.h]hDBecause things like lock contention can severely impact performance.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]whyah ]h"]whyah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hHowh]hHow}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hLockdep 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]hLockdep 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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh literal_block)}(hX __acquire | lock _____ | \ | __contended | | | | _______/ |/ | __acquired | . . | __release | unlock lock, unlock - the regular lock functions __* - the hooks <> - statesh]hX __acquire | lock _____ | \ | __contended | | | | _______/ |/ | __acquired | . . | __release | unlock lock, unlock - the regular lock functions __* - the hooks <> - states}hj(sbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1j&hhhKhjhhubh)}(h5With these hooks we provide the following statistics:h]h5With these hooks we provide the following statistics:}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK0hjhhubh block_quote)}(hXcon-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]hdefinition_list)}(hhh](hdefinition_list_item)}(h@con-bounces - number of lock contention that involved x-cpu datah](hterm)}(h con-bouncesh]h con-bounces}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK2hjSubh definition)}(hhh]h bullet_list)}(hhh]h list_item)}(h2number of lock contention that involved x-cpu datah]h)}(hjuh]h2number of lock contention that involved x-cpu data}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hjsubah}(h]h ]h"]h$]h&]uh1jqhjnubah}(h]h ]h"]h$]h&]bullet-uh1jlhhhK3hjiubah}(h]h ]h"]h$]h&]uh1jghjSubeh}(h]h ]h"]h$]h&]uh1jQhhhK2hjNubjR)}(h:contentions - number of lock acquisitions that had to waith](jX)}(h contentionsh]h contentions}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK4hjubjh)}(hhh]jm)}(hhh]jr)}(h,number of lock acquisitions that had to waith]h)}(hjh]h,number of lock acquisitions that had to wait}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK5hjubah}(h]h ]h"]h$]h&]uh1jqhjubah}(h]h ]h"]h$]h&]jjuh1jlhhhK5hjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhK4hjNubjR)}(hwait 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 lockh](jX)}(h wait timeh]h wait time}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK=hjubjh)}(hhh]jM)}(hhh](jR)}(h:min - shortest (non-0) time we ever had to wait for a lockh](jX)}(hminh]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK7hjubjh)}(hhh]jm)}(hhh]jr)}(h4shortest (non-0) time we ever had to wait for a lockh]h)}(hjh]h4shortest (non-0) time we ever had to wait for a lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjubah}(h]h ]h"]h$]h&]uh1jqhj ubah}(h]h ]h"]h$]h&]jjuh1jlhhhK8hj ubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhK7hjubjR)}(h1max - longest time we ever had to wait for a lockh](jX)}(hmaxh]hmax}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK9hj8ubjh)}(hhh]jm)}(hhh]jr)}(h+longest time we ever had to wait for a lockh]h)}(hjRh]h+longest time we ever had to wait for a lock}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjPubah}(h]h ]h"]h$]h&]uh1jqhjMubah}(h]h ]h"]h$]h&]jjuh1jlhhhK:hjJubah}(h]h ]h"]h$]h&]uh1jghj8ubeh}(h]h ]h"]h$]h&]uh1jQhhhK9hjubjR)}(h0total - total time we spend waiting on this lockh](jX)}(htotalh]htotal}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK;hjyubjh)}(hhh]jm)}(hhh]jr)}(h(total time we spend waiting on this lockh]h)}(hjh]h(total time we spend waiting on this lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jqhjubah}(h]h ]h"]h$]h&]jjuh1jlhhhK>hjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhK=hjubeh}(h]h ]h"]h$]h&]uh1jLhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhK=hjNubjR)}(hBacq-bounces - number of lock acquisitions that involved x-cpu datah](jX)}(h acq-bouncesh]h acq-bounces}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhK?hj ubjh)}(hhh]jm)}(hhh]jr)}(h4number of lock acquisitions that involved x-cpu datah]h)}(hj'h]h4number of lock acquisitions that involved x-cpu data}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hj%ubah}(h]h ]h"]h$]h&]uh1jqhj"ubah}(h]h ]h"]h$]h&]jjuh1jlhhhK@hjubah}(h]h ]h"]h$]h&]uh1jghj ubeh}(h]h ]h"]h$]h&]uh1jQhhhK?hjNubjR)}(h/acquisitions - number of times we took the lockh](jX)}(h acquisitionsh]h acquisitions}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKAhjNubjh)}(hhh]jm)}(hhh]jr)}(h number of times we took the lockh]h)}(hjhh]h number of times we took the lock}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjfubah}(h]h ]h"]h$]h&]uh1jqhjcubah}(h]h ]h"]h$]h&]jjuh1jlhhhKBhj`ubah}(h]h ]h"]h$]h&]uh1jghjNubeh}(h]h ]h"]h$]h&]uh1jQhhhKAhjNubjR)}(hhold 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](jX)}(h hold timeh]h hold time}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKKhjubjh)}(hhh]jM)}(hhh](jR)}(h1min - shortest (non-0) time we ever held the lockh](jX)}(hminh]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKDhjubjh)}(hhh]jm)}(hhh]jr)}(h+shortest (non-0) time we ever held the lockh]h)}(hjh]h+shortest (non-0) time we ever held the lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKEhjubah}(h]h ]h"]h$]h&]uh1jqhjubah}(h]h ]h"]h$]h&]jjuh1jlhhhKEhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKDhjubjR)}(h(max - longest time we ever held the lockh](jX)}(hmaxh]hmax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKFhjubjh)}(hhh]jm)}(hhh]jr)}(h"longest time we ever held the lockh]h)}(hjh]h"longest time we ever held the lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhjubah}(h]h ]h"]h$]h&]uh1jqhjubah}(h]h ]h"]h$]h&]jjuh1jlhhhKGhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKFhjubjR)}(h%total - total time this lock was heldh](jX)}(htotalh]htotal}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKHhj)ubjh)}(hhh]jm)}(hhh]jr)}(htotal time this lock was heldh]h)}(hjCh]htotal time this lock was held}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjAubah}(h]h ]h"]h$]h&]uh1jqhj>ubah}(h]h ]h"]h$]h&]jjuh1jlhhhKIhj;ubah}(h]h ]h"]h$]h&]uh1jghj)ubeh}(h]h ]h"]h$]h&]uh1jQhhhKHhjubjR)}(h&avg - average time this lock was held h](jX)}(havgh]havg}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1jWhhhKKhjjubjh)}(hhh]jm)}(hhh]jr)}(h average time this lock was held h]h)}(haverage time this lock was heldh]haverage time this lock was held}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjubah}(h]h ]h"]h$]h&]uh1jqhjubah}(h]h ]h"]h$]h&]jjuh1jlhhhKKhj|ubah}(h]h ]h"]h$]h&]uh1jghjjubeh}(h]h ]h"]h$]h&]uh1jQhhhKKhjubeh}(h]h ]h"]h$]h&]uh1jLhjubah}(h]h ]h"]h$]h&]uh1jghjubeh}(h]h ]h"]h$]h&]uh1jQhhhKKhjNubeh}(h]h ]h"]h$]h&]uh1jLhjHubah}(h]h ]h"]h$]h&]uh1jFhhhK2hjhhubh)}(hRThese numbers are gathered per lock class, per read/write state (when applicable).h]hRThese numbers are gathered per lock class, per read/write state (when applicable).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjhhubh)}(huIt also tracks 4 contention points per class. A contention point is a call site that had to wait on lock acquisition.h]huIt also tracks 4 contention points per class. A contention point is a call site that had to wait on lock acquisition.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjhhubh)}(hhh](h)}(h Configurationh]h Configuration}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKTubh)}(h1Lock statistics are enabled via CONFIG_LOCK_STAT.h]h1Lock statistics are enabled via CONFIG_LOCK_STAT.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjhhubeh}(h] configurationah ]h"] configurationah$]h&]uh1hhjhhhhhKTubh)}(hhh](h)}(hUsageh]hUsage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKYubh)}(h!Enable collection of statistics::h]h Enable collection of statistics:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hj hhubj')}(h$# echo 1 >/proc/sys/kernel/lock_stath]h$# echo 1 >/proc/sys/kernel/lock_stat}hj,sbah}(h]h ]h"]h$]h&]j6j7uh1j&hhhK]hj hhubh)}(h"Disable collection of statistics::h]h!Disable collection of statistics:}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hj hhubj')}(h$# echo 0 >/proc/sys/kernel/lock_stath]h$# echo 0 >/proc/sys/kernel/lock_stat}hjHsbah}(h]h ]h"]h$]h&]j6j7uh1j&hhhKahj hhubh)}(h%Look at the current lock statistics::h]h$Look at the current lock statistics:}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKchj hhubj')}(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/0x1b0h]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}hjdsbah}(h]h ]h"]h$]h&]j6j7uh1j&hhhKehj hhubh)}(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.}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hLines 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]hLines 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(h-The integer part of the time values is in us.h]h-The integer part of the time values is in us.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(h2Dealing with nested locks, subclasses may appear::h]h1Dealing with nested locks, subclasses may appear:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj')}(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/0x25ah]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}hjsbah}(h]h ]h"]h$]h&]j6j7uh1j&hhhKhj hhubh)}(hLine 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]hLine 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hView the top contending locks::h]hView the top contending locks:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj')}(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.76h]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}hjsbah}(h]h ]h"]h$]h&]j6j7uh1j&hhhKhj hhubh)}(hClear the statistics::h]hClear the statistics:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj')}(h# echo 0 > /proc/lock_stath]h# echo 0 > /proc/lock_stat}hjsbah}(h]h ]h"]h$]h&]j6j7uh1j&hhhKhj hhubeh}(h]usageah ]h"]usageah$]h&]uh1hhjhhhhhKYubeh}(h]howah ]h"]howah$]h&]uh1hhhhhhhhKubeh}(h]lock-statisticsah ]h"]lock statisticsah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjGerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j!jhhjjjjj jjju nametypes}(j!h݉jjj juh}(jhhhjhjjjjjj u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.