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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 7 Apr 2012 15:49:10 +0800
From:	Hillf Danton <dhillf@...il.com>
To:	Dario Faggioli <raistlin@...ux.it>,
	Juri Lelli <juri.lelli@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Hillf Danton <dhillf@...il.com>
Subject: [PATCH] DLS: add dl_time_equal helper in deadline scheduler

Hi all

A tiny helper, dl_time_equal, is added for easing readers.

And dl_entity_preempt is redefined to be bool, and its comment is also changed.

Signed-off-by: Hillf Danton <dhillf@...il.com>
---

--- a/kernel/sched_dl.c	Sat Apr  7 15:00:28 2012
+++ b/kernel/sched_dl.c	Sat Apr  7 15:20:10 2012
@@ -16,16 +16,21 @@
  */
 static const struct sched_class dl_sched_class;

-static inline int dl_time_before(u64 a, u64 b)
+static inline bool dl_time_equal(u64 a, u64 b)
+{
+	return a == b;
+}
+
+static inline bool dl_time_before(u64 a, u64 b)
 {
 	return (s64)(a - b) < 0;
 }

 /*
- * Tells if entity @a should preempt entity @b.
+ * Return true if entity @a could preempt entity @b in term of deadline
  */
-static inline
-int dl_entity_preempt(struct sched_dl_entity *a, struct sched_dl_entity *b)
+static inline bool
+dl_entity_preempt(struct sched_dl_entity *a, struct sched_dl_entity *b)
 {
 	return dl_time_before(a->deadline, b->deadline);
 }
@@ -885,7 +890,7 @@ static void check_preempt_curr_dl(struct
 	 * In the unlikely case current and p have the same deadline
 	 * let us try to decide what's the best thing to do...
 	 */
-	if ((s64)(p->dl.deadline - rq->curr->dl.deadline) == 0 &&
+	if (dl_time_equal(p->dl.deadline, rq->curr->dl.deadline) &&
 	    !need_resched())
 		check_preempt_equal_dl(rq, p);
 #endif /* CONFIG_SMP */
--
--
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