]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Don't disable irqs when taking the tasklist_lock read_lock
authorSoumya PN <soumya.p.n@hpe.com>
Tue, 17 May 2016 16:01:14 +0000 (21:31 +0530)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 20 May 2016 17:19:37 +0000 (13:19 -0400)
commit07e467b03efec00680e5122915dc3d88f63ede2b
treebfc725d59bb98e3726c6884add2445c233c64eb7
parentf124af8a3abc7d67364abd967413ea230cd249f5
ftrace: Don't disable irqs when taking the tasklist_lock read_lock

In ftrace.c inside the function alloc_retstack_tasklist() (which will be
invoked when function_graph tracing is on) the tasklist_lock is being
held as reader while iterating through a list of threads. Here the lock
is being held as reader with irqs disabled. The tasklist_lock is never
write_locked in interrupt context so it is safe to not disable interrupts
for the duration of read_lock in this block which, can be significant,
given the block of code iterates through all threads. Hence changing the
code to call read_lock() and read_unlock() instead of read_lock_irqsave()
and read_unlock_irqrestore().

A similar change was made in commits: cd007c927f17 ("tracing: Change
syscall_*regfunc() to check PF_KTHREAD and use for_each_process_thread()")'
and 20d9197b31d3 ("sched: normalize_rt_tasks(): Don't use _irqsave for
tasklist_lock, use task_rq_lock()")'

Link: http://lkml.kernel.org/r/1463500874-77480-1-git-send-email-soumya.p.n@hpe.com
Signed-off-by: Soumya PN <soumya.p.n@hpe.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c