Re: [PATCH] sched: Add SCHED_BGND (background) scheduling policy

From: Peter Williams
Date: Tue Jul 04 2006 - 23:04:44 EST


Con Kolivas wrote:
some quick comments within code below.

On Wednesday 05 July 2006 09:35, Peter Williams wrote:
@@ -761,8 +770,18 @@ static void set_load_weight(struct task_
else
#endif
p->load_weight = RTPRIO_TO_LOAD_WEIGHT(p->rt_priority);
- } else
- p->load_weight = PRIO_TO_LOAD_WEIGHT(p->static_prio);
+ } else {
+ /*
+ * Reduce the probability of a task escaping the background
+ * due to load balancing leaving it on a lighly used CPU
+ * Can't use zero as that would kill load balancing when only
+ * background tasks are running.
+ */
+ if (bgnd_task(p))
+ p->load_weight = LOAD_WEIGHT(MIN_TIMESLICE / 2 ? : 1);

Why not just set it to 1 for all idleprio tasks? The granularity will be lost at anything lower anyway and it avoids a more complex calculation.

I missed this one in my previous reply. I agree, what you say makes sense. I was in my "think too hard" mode and probably thinking (unnecessarily) about how it might effect the smoothed load calculations.

Peter
--
Peter Williams pwil3058@xxxxxxxxxxxxxx

"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce
-
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/