[PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair

From: Abel Vesa
Date: Mon Apr 06 2015 - 14:43:51 EST


This patch removes function wakeup_gran and its call by calling directly
calc_delta_fair function with sysctl_sched_wakeup_granularity and se as arguments.

Signed-off-by: Abel Vesa <abelvesa@xxxxxxxxx>
---
kernel/sched/fair.c | 38 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 46855d0..63a4051 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4927,27 +4927,6 @@ migrate_task_rq_fair(struct task_struct *p, int next_cpu)
}
#endif /* CONFIG_SMP */

-static unsigned long
-wakeup_gran(struct sched_entity *curr, struct sched_entity *se)
-{
- unsigned long gran = sysctl_sched_wakeup_granularity;
-
- /*
- * Since its curr running now, convert the gran from real-time
- * to virtual-time in his units.
- *
- * By using 'se' instead of 'curr' we penalize light tasks, so
- * they get preempted easier. That is, if 'se' < 'curr' then
- * the resulting gran will be larger, therefore penalizing the
- * lighter, if otoh 'se' > 'curr' then the resulting gran will
- * be smaller, again penalizing the lighter task.
- *
- * This is especially important for buddies when the leftmost
- * task is higher priority than the buddy.
- */
- return calc_delta_fair(gran, se);
-}
-
/*
* Should 'se' preempt 'curr'.
*
@@ -4970,7 +4949,22 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
if (vdiff <= 0)
return -1;

- gran = wakeup_gran(curr, se);
+ /*
+ * Since its curr running now, convert the gran from real-time
+ * to virtual-time in his units.
+ *
+ * By using 'se' instead of 'curr' we penalize light tasks, so
+ * they get preempted easier. That is, if 'se' < 'curr' then
+ * the resulting gran will be larger, therefore penalizing the
+ * lighter, if otoh 'se' > 'curr' then the resulting gran will
+ * be smaller, again penalizing the lighter task.
+ *
+ * This is especially important for buddies when the leftmost
+ * task is higher priority than the buddy.
+ */
+
+ gran = calc_delta_fair(sysctl_sched_wakeup_granularity, se);
+
if (vdiff > gran)
return 1;

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/