Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363388

[PATCH 2/3] Reset nr_balance_failed after active balancing

From Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] Reset nr_balance_failed after active balancing
Date 2016-03-23 13:30 +0100
Message-ID <rfQ5c-3jc-1@gated-at.bofh.it> (permalink)
References <rfPiO-2K3-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


To force a task migration during active balancing, nr_balance_failed is set
to cache_nice_tries + 1. However nr_balance_failed is not reset. As a side
effect, the next regular load balance under the same sd, a cache hot task
might be migrated, just because nr_balance_failed count is high.

Resetting the nr_balance_failed after a successful active balance, ensures
that a hot task is not unreasonably migrated. This can be verified by
looking at number of hot task migrations reported by /proc/schedstat.

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
 kernel/sched/fair.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9abfb16..fae05f4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7294,10 +7294,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
 					&busiest->active_balance_work);
 			}
 
-			/*
-			 * We've kicked active balancing, reset the failure
-			 * counter.
-			 */
+			/* We've kicked active balancing, force task migration. */
 			sd->nr_balance_failed = sd->cache_nice_tries+1;
 		}
 	} else
@@ -7532,10 +7529,13 @@ static int active_load_balance_cpu_stop(void *data)
 		schedstat_inc(sd, alb_count);
 
 		p = detach_one_task(&env);
-		if (p)
+		if (p) {
 			schedstat_inc(sd, alb_pushed);
-		else
+			/* Active balancing done, reset the failure counter. */
+			sd->nr_balance_failed = 0;
+		} else {
 			schedstat_inc(sd, alb_failed);
+		}
 	}
 	rcu_read_unlock();
 out_unlock:
-- 
1.8.3.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] sched/fair: Fix asym packing to select correct cpu Srikar Dronamraju <srikar@linux.vnet.ibm.com> - 2016-03-23 12:40 +0100
  [PATCH 2/3] Reset nr_balance_failed after active balancing Srikar Dronamraju <srikar@linux.vnet.ibm.com> - 2016-03-23 13:30 +0100
    [tip:sched/core] sched/fair: Reset nr_balance_failed after active  balancing tip-bot for Srikar Dronamraju <tipbot@zytor.com> - 2016-03-31 11:30 +0200
  Re: [PATCH 1/3] sched/fair: Fix asym packing to select correct cpu Michael Neuling <mikey@neuling.org> - 2016-03-24 00:50 +0100
  Re: [PATCH 1/3] sched/fair: Fix asym packing to select correct cpu Peter Zijlstra <peterz@infradead.org> - 2016-03-29 14:20 +0200
    Re: [PATCH 1/3] sched/fair: Fix asym packing to select correct cpu Srikar Dronamraju <srikar@linux.vnet.ibm.com> - 2016-03-31 13:50 +0200

csiph-web