Page MenuHomeFreeBSD

Fix sched_balance_pair comment and move lock
ActivePublic

Authored by harrison-astrodog.net on Feb 26 2015, 11:45 AM.
Tags
None
Referenced Files
F99666: Fix_sched_balance_pair_comment_and_move_lock
Feb 26 2015, 11:45 AM
Subscribers
None
Index: sys/kern/sched_ule.c
===================================================================
--- sys/kern/sched_ule.c (revision 278968)
+++ sys/kern/sched_ule.c (working copy)
@@ -908,15 +909,21 @@
{
int moved;
int cpu;
-
+
+ /*
+ * Don't bother to lock if balancing doesn't make sense.
+ */
+
+ if (high->tdq_load <= low->tdq_load)
+ return(0);
+
tdq_lock_pair(high, low);
moved = 0;
/*
- * Determine what the imbalance is and then adjust that to how many
- * threads we actually have to give up (transferable).
+ * Move one thread from high to low if high has at least 1
+ * transferable thread.
*/
- if (high->tdq_transferable != 0 && high->tdq_load > low->tdq_load &&
- (moved = tdq_move(high, low)) > 0) {
+ if (high->tdq_transferable == 0 && (moved = tdq_move(high, low)) > 0) {
/*
* In case the target isn't the current cpu IPI it to force a
* reschedule with the new workload.

Event Timeline

harrison-astrodog.net changed the title of this paste from untitled to Fix sched_balance_pair comment and move lock.
harrison-astrodog.net updated the paste's language from autodetect to autodetect.