[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140817152616.GB17984@redhat.com>
Date: Sun, 17 Aug 2014 17:26:16 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Rik van Riel <riel@...hat.com>,
Mike Galbraith <umgwanakikbuti@...il.com>,
Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
Frank Mayhar <fmayhar@...gle.com>,
Frederic Weisbecker <fweisbec@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Sanjay Rao <srao@...hat.com>,
Larry Woodman <lwoodman@...hat.com>,
linux-kernel@...r.kernel.org, Kirill Tkhai <tkhai@...dex.ru>
Subject: [PATCH 1/2] sched: normalize_rt_tasks: don't use _irqsave for
tasklist_lock, use task_rq_lock()
1. read_lock(tasklist_lock) does not need to disable irqs.
2. ->mm != NULL is the common mistake, use PF_KTHREAD.
3. The second ->mm check can be simply removed.
4. task_rq_lock() looks better than raw_spin_lock(&p->pi_lock) +
__task_rq_lock().
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
kernel/sched/core.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 8a6506f..eee12b3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7137,12 +7137,12 @@ void normalize_rt_tasks(void)
unsigned long flags;
struct rq *rq;
- read_lock_irqsave(&tasklist_lock, flags);
+ read_lock(&tasklist_lock);
for_each_process_thread(g, p) {
/*
* Only normalize user tasks:
*/
- if (!p->mm)
+ if (p->flags & PF_KTHREAD)
continue;
p->se.exec_start = 0;
@@ -7157,20 +7157,16 @@ void normalize_rt_tasks(void)
* Renice negative nice level userspace
* tasks back to 0:
*/
- if (task_nice(p) < 0 && p->mm)
+ if (task_nice(p) < 0)
set_user_nice(p, 0);
continue;
}
- raw_spin_lock(&p->pi_lock);
- rq = __task_rq_lock(p);
-
+ rq = task_rq_lock(p, &flags);
normalize_task(rq, p);
-
- __task_rq_unlock(rq);
- raw_spin_unlock(&p->pi_lock);
+ task_rq_unlock(rq, p, &flags);
}
- read_unlock_irqrestore(&tasklist_lock, flags);
+ read_unlock(&tasklist_lock);
}
#endif /* CONFIG_MAGIC_SYSRQ */
--
1.5.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists