summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLin Feng <linf@wangsu.com>2019-05-14 18:42:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-14 22:52:49 -0400
commit0cc75888dad112395df0ac755915ceb79811831c (patch)
tree96f90ffd7e02be7b99619dd7ca2d4d1bd338c5fb
parent831246570d34692e0550da952d0655bdcc985419 (diff)
kernel/latencytop.c: remove unnecessary checks for latencytop_enabled
1. In latencytop source codes, we only have such calling chain: account_scheduler_latency(struct task_struct *task, int usecs, int inter) { if (unlikely(latencytop_enabled)) /* the outtermost check */ __account_scheduler_latency(task, usecs, inter); } __account_scheduler_latency account_global_scheduler_latency if (!latencytop_enabled) So, the inner check for latencytop_enabled is not necessary at all. 2. In clear_all_latency_tracing and now is called clear_tsk_latency_tracing the check for latencytop_enabled is redundant and buggy to some extent. We have no reason to refuse clearing the /proc/$pid/latency if latencytop_enabled is set to 0, considering that if we use latencytop manually by echo 0 > /proc/sys/kernel/latencytop, then we want to clear /proc/$pid/latency and failed. Also we don't have such check in brother function clear_global_latency_tracing. Notes: These changes are only visible to users who set CONFIG_LATENCYTOP and won't change user tool latencytop's behavior. Link: http://lkml.kernel.org/r/20190226114602.16902-2-linf@wangsu.com Signed-off-by: Lin Feng <linf@wangsu.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Fabian Frederick <fabf@skynet.be> Cc: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/latencytop.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/kernel/latencytop.c b/kernel/latencytop.c
index 99a5b5f46dc5..bbde5614da71 100644
--- a/kernel/latencytop.c
+++ b/kernel/latencytop.c
@@ -71,9 +71,6 @@ void clear_all_latency_tracing(struct task_struct *p)
71{ 71{
72 unsigned long flags; 72 unsigned long flags;
73 73
74 if (!latencytop_enabled)
75 return;
76
77 raw_spin_lock_irqsave(&latency_lock, flags); 74 raw_spin_lock_irqsave(&latency_lock, flags);
78 memset(&p->latency_record, 0, sizeof(p->latency_record)); 75 memset(&p->latency_record, 0, sizeof(p->latency_record));
79 p->latency_record_count = 0; 76 p->latency_record_count = 0;
@@ -96,9 +93,6 @@ account_global_scheduler_latency(struct task_struct *tsk,
96 int firstnonnull = MAXLR + 1; 93 int firstnonnull = MAXLR + 1;
97 int i; 94 int i;
98 95
99 if (!latencytop_enabled)
100 return;
101
102 /* skip kernel threads for now */ 96 /* skip kernel threads for now */
103 if (!tsk->mm) 97 if (!tsk->mm)
104 return; 98 return;