• Tetsuo Handa's avatar
    kernel/hung_task.c: defer showing held locks · 780cbcf2
    Tetsuo Handa authored
    When I was running my testcase which may block hundreds of threads on fs
    locks, I got lockup due to output from debug_show_all_locks() added by
    commit b2d4c2ed ("locking/hung_task: Show all locks").
    
    For example, if 1000 threads were blocked in TASK_UNINTERRUPTIBLE state
    and 500 out of 1000 threads hold some lock, debug_show_all_locks() from
    for_each_process_thread() loop will report locks held by 500 threads for
    1000 times.  This is a too much noise.
    
    In order to make sure rcu_lock_break() is called frequently, we should
    avoid calling debug_show_all_locks() from for_each_process_thread() loop
    because debug_show_all_locks() effectively calls for_each_process_thread()
    loop.  Let's defer calling debug_show_all_locks() till before panic() or
    leaving for_each_process_thread() loop.
    
    Link: http://lkml.kernel.org/r/1489296834-60436-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
    
    Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Reviewed-by: Veg...
    780cbcf2
hung_task.c 6.16 KB