From: Lin Feng <linf@wangsu.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, adobriyan@gmail.com, fabf@skynet.be,
arjan@infradead.org, linf@wangsu.com
Subject: [PATCH 2/2] kernel/latencytop.c: remove unnecessary checks for latencytop_enabled
Date: Tue, 26 Feb 2019 19:46:02 +0800 [thread overview]
Message-ID: <20190226114602.16902-2-linf@wangsu.com> (raw)
In-Reply-To: <20190226114602.16902-1-linf@wangsu.com>
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.
Aslo we don't have such check in brother function
clear_global_latency_tracing.
Notes: These changes only visible to users who sets CONFIG_LATENCYTOP and
won't change user tool latencytop's behaviors.
Signed-off-by: Lin Feng <linf@wangsu.com>
---
kernel/latencytop.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/kernel/latencytop.c b/kernel/latencytop.c
index 9e794b49791e..897895efafd9 100644
--- a/kernel/latencytop.c
+++ b/kernel/latencytop.c
@@ -71,9 +71,6 @@ void clear_tsk_latency_tracing(struct task_struct *p)
{
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 task_struct *tsk,
int firstnonnull = MAXLR + 1;
int i;
- if (!latencytop_enabled)
- return;
-
/* skip kernel threads for now */
if (!tsk->mm)
return;
--
2.20.1
prev parent reply other threads:[~2019-02-26 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 11:46 [PATCH 1/2] kernel/latencytop.c: rename clear_all_latency_tracing to clear_tsk_latency_tracing Lin Feng
2019-02-26 11:46 ` Lin Feng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190226114602.16902-2-linf@wangsu.com \
--to=linf@wangsu.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=fabf@skynet.be \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®