From: tip-bot for Oleg Nesterov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
torvalds@linux-foundation.org, peterz@infradead.org,
umgwanakikbuti@gmail.com, tkhai@yandex.ru, tglx@linutronix.de,
oleg@redhat.com
Subject: [tip:sched/core] sched: print_rq(): Don't use tasklist_lock
Date: Wed, 24 Sep 2014 07:56:22 -0700 [thread overview]
Message-ID: <tip-5bd96ab6fef66ec6b9f54134364e618fd0f8f2f3@git.kernel.org> (raw)
In-Reply-To: <20140921193341.GA28628@redhat.com>
Commit-ID: 5bd96ab6fef66ec6b9f54134364e618fd0f8f2f3
Gitweb: http://git.kernel.org/tip/5bd96ab6fef66ec6b9f54134364e618fd0f8f2f3
Author: Oleg Nesterov <oleg@redhat.com>
AuthorDate: Sun, 21 Sep 2014 21:33:41 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 24 Sep 2014 14:47:04 +0200
sched: print_rq(): Don't use tasklist_lock
read_lock_irqsave(tasklist_lock) in print_rq() looks strange. We do
not need to disable irqs, and they are already disabled by the caller.
And afaics this lock buys nothing, we can rely on rcu_read_lock().
In this case it makes sense to also move rcu_read_lock/unlock from
the caller to print_rq().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Kirill Tkhai <tkhai@yandex.ru>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20140921193341.GA28628@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/debug.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index c7fe1ea0..ce33780 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -150,7 +150,6 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
{
struct task_struct *g, *p;
- unsigned long flags;
SEQ_printf(m,
"\nrunnable tasks:\n"
@@ -159,14 +158,14 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
"------------------------------------------------------"
"----------------------------------------------------\n");
- read_lock_irqsave(&tasklist_lock, flags);
+ rcu_read_lock();
for_each_process_thread(g, p) {
if (task_cpu(p) != rq_cpu)
continue;
print_task(m, rq, p);
}
- read_unlock_irqrestore(&tasklist_lock, flags);
+ rcu_read_unlock();
}
void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
@@ -331,9 +330,7 @@ do { \
print_cfs_stats(m, cpu);
print_rt_stats(m, cpu);
- rcu_read_lock();
print_rq(m, rq, cpu);
- rcu_read_unlock();
spin_unlock_irqrestore(&sched_debug_lock, flags);
SEQ_printf(m, "\n");
}
prev parent reply other threads:[~2014-09-24 14:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-21 19:33 [PATCH 0/3] sched: fix tg_has_rt_tasks(), tasklist_lock cleanups Oleg Nesterov
2014-09-21 19:33 ` [PATCH 1/3] sched: fix the task-group check in tg_has_rt_tasks() Oleg Nesterov
2014-09-22 6:54 ` Kirill Tkhai
2014-09-24 14:55 ` [tip:sched/core] sched: Fix " tip-bot for Oleg Nesterov
2014-09-21 19:33 ` [PATCH 2/3] sched: normalize_rt_tasks: don't use _irqsave for tasklist_lock, use task_rq_lock() Oleg Nesterov
2014-09-24 14:56 ` [tip:sched/core] sched: normalize_rt_tasks(): Don' t " tip-bot for Oleg Nesterov
2014-09-21 19:33 ` [PATCH 3/3] sched: print_rq: don't use tasklist_lock Oleg Nesterov
2014-09-24 14:56 ` tip-bot for Oleg Nesterov [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=tip-5bd96ab6fef66ec6b9f54134364e618fd0f8f2f3@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tkhai@yandex.ru \
--cc=torvalds@linux-foundation.org \
--cc=umgwanakikbuti@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).