The patch titled Subject: kernel/latencytop.c: remove unnecessary checks for latencytop_enabled has been added to the -mm tree. Its filename is kernel-latencytopc-remove-unnecessary-checks-for-latencytop_enabled.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kernel-latencytopc-remove-unnecessary-checks-for-latencytop_enabled.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kernel-latencytopc-remove-unnecessary-checks-for-latencytop_enabled.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Lin Feng <linf@xxxxxxxxxx> Subject: 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@xxxxxxxxxx Signed-off-by: Lin Feng <linf@xxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: Fabian Frederick <fabf@xxxxxxxxx> Cc: Arjan van de Ven <arjan@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/latencytop.c | 6 ------ 1 file changed, 6 deletions(-) --- a/kernel/latencytop.c~kernel-latencytopc-remove-unnecessary-checks-for-latencytop_enabled +++ a/kernel/latencytop.c @@ -71,9 +71,6 @@ void clear_tsk_latency_tracing(struct ta { unsigned long flags; - if (!latencytop_enabled) - return; - raw_spin_lock_irqsave(&latency_lock, flags); memset(&p->latency_record, 0, sizeof(p->latency_record)); p->latency_record_count = 0; @@ -96,9 +93,6 @@ account_global_scheduler_latency(struct int firstnonnull = MAXLR + 1; int i; - if (!latencytop_enabled) - return; - /* skip kernel threads for now */ if (!tsk->mm) return; _ Patches currently in -mm which might be from linf@xxxxxxxxxx are kernel-latencytopc-rename-clear_all_latency_tracing-to-clear_tsk_latency_tracing.patch kernel-latencytopc-remove-unnecessary-checks-for-latencytop_enabled.patch