lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 12 May 2015 22:46:43 +0800
From:	Xunlei Pang <xlpang@....com>
To:	linux-kernel@...r.kernel.org
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Juri Lelli <juri.lelli@...il.com>,
	Ingo Molnar <mingo@...hat.com>,
	Xunlei Pang <pang.xunlei@...aro.org>
Subject: [PATCH v3 3/4] sched/rt: Remove redundant conditions from task_woken_rt()

From: Xunlei Pang <pang.xunlei@...aro.org>

- Remove "has_pushable_tasks(rq)".
  Because for queued p, "!task_running(rq, p)" and "p->nr_cpus_allowed > 1"
  already imply that "has_pushable_tasks(rq)" is true.

- Remove "!test_tsk_need_resched(rq->curr)".
  The condtion mainly intends to ensure higher priority rt tasks won't be pushed
  away. I can think of two reasons below for getting rid of it.
  1) With following "rq->curr->prio <= p->prio", we still can guarantee that
     purpose. "rq->curr->prio <= p->prio" implies the "need resched flag" wasn't
     set by check_preempt_curr() except the one set by check_preempt_equal_prio()
     for equal prio cases(In this case, if the condition is removed, it may result
     in an extra push_rt_tasks(), but this doesn't cause the wrong logic, in fact
     this extra push_rt_tasks() will probably return quickly for the case).

     Addtionally, there're also cases the "need resched flag" got set before the
     waking, with current implementation it needn't to push lower priority tasks
     as the cpu will schedule, while it will do an extra pushing if the condition
     is removed. But on the other hand, we can get a timely pushing for the woken
     tasks after the condition is removed(better for the non-preemptible kernel).

  2) With following condtion "rq->curr->nr_cpus_allowed < 2" which was added by
     commit b3bc211cfe7d ("sched: Give CPU bound RT tasks preference"), in the
     scenario descibed in it, "need resched flag" was already set before by
     check_preempt_curr(), thus "!test_tsk_need_resched(rq->curr)" is always false
     which means with current implementation the commit is futile for task_woken_rt().
  So, by removing this condition, we get the right logic.

Signed-off-by: Xunlei Pang <pang.xunlei@...aro.org>
---
 kernel/sched/rt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4a49c6a..4bd8551 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2232,8 +2232,6 @@ out:
 static void task_woken_rt(struct rq *rq, struct task_struct *p)
 {
 	if (!task_running(rq, p) &&
-	    !test_tsk_need_resched(rq->curr) &&
-	    has_pushable_tasks(rq) &&
 	    p->nr_cpus_allowed > 1 &&
 	    (dl_task(rq->curr) || rt_task(rq->curr)) &&
 	    (rq->curr->nr_cpus_allowed < 2 ||
-- 
1.9.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

Powered by Openwall GNU/*/Linux Powered by OpenVZ