Skip to content

Commit 2d4056f

Browse files
srikardIngo Molnar
authored andcommitted
sched/numa: Remove numa_has_capacity()
task_numa_find_cpu() helps to find the CPU to swap/move the task to. It's guarded by numa_has_capacity(). However node not having capacity shouldn't deter a task swapping if it helps NUMA placement. Further load_too_imbalanced(), which evaluates possibilities of move/swap, provides similar checks as numa_has_capacity. Hence remove numa_has_capacity() to enhance possibilities of task swapping even if load is imbalanced. Running SPECjbb2005 on a 4 node machine and comparing bops/JVM JVMS LAST_PATCH WITH_PATCH %CHANGE 16 25657.9 25804.1 0.569 1 74435 73413 -1.37 Signed-off-by: Srikar Dronamraju <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Rik van Riel <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 0ad4e3d commit 2d4056f

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

kernel/sched/fair.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,6 @@ struct numa_stats {
14561456
unsigned long compute_capacity;
14571457

14581458
unsigned int nr_running;
1459-
int has_free_capacity;
14601459
};
14611460

14621461
/*
@@ -1483,8 +1482,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid)
14831482
* the @ns structure is NULL'ed and task_numa_compare() will
14841483
* not find this node attractive.
14851484
*
1486-
* We'll either bail at !has_free_capacity, or we'll detect a huge
1487-
* imbalance and bail there.
1485+
* We'll detect a huge imbalance and bail there.
14881486
*/
14891487
if (!cpus)
14901488
return;
@@ -1495,7 +1493,6 @@ static void update_numa_stats(struct numa_stats *ns, int nid)
14951493

14961494
capacity = min_t(unsigned, capacity,
14971495
DIV_ROUND_CLOSEST(ns->compute_capacity, SCHED_CAPACITY_SCALE));
1498-
ns->has_free_capacity = (ns->nr_running < capacity);
14991496
}
15001497

15011498
struct task_numa_env {
@@ -1698,31 +1695,6 @@ static void task_numa_find_cpu(struct task_numa_env *env,
16981695
}
16991696
}
17001697

1701-
/* Only move tasks to a NUMA node less busy than the current node. */
1702-
static bool numa_has_capacity(struct task_numa_env *env)
1703-
{
1704-
struct numa_stats *src = &env->src_stats;
1705-
struct numa_stats *dst = &env->dst_stats;
1706-
1707-
if (src->has_free_capacity && !dst->has_free_capacity)
1708-
return false;
1709-
1710-
/*
1711-
* Only consider a task move if the source has a higher load
1712-
* than the destination, corrected for CPU capacity on each node.
1713-
*
1714-
* src->load dst->load
1715-
* --------------------- vs ---------------------
1716-
* src->compute_capacity dst->compute_capacity
1717-
*/
1718-
if (src->load * dst->compute_capacity * env->imbalance_pct >
1719-
1720-
dst->load * src->compute_capacity * 100)
1721-
return true;
1722-
1723-
return false;
1724-
}
1725-
17261698
static int task_numa_migrate(struct task_struct *p)
17271699
{
17281700
struct task_numa_env env = {
@@ -1777,8 +1749,7 @@ static int task_numa_migrate(struct task_struct *p)
17771749
update_numa_stats(&env.dst_stats, env.dst_nid);
17781750

17791751
/* Try to find a spot on the preferred nid. */
1780-
if (numa_has_capacity(&env))
1781-
task_numa_find_cpu(&env, taskimp, groupimp);
1752+
task_numa_find_cpu(&env, taskimp, groupimp);
17821753

17831754
/*
17841755
* Look at other nodes in these cases:
@@ -1808,8 +1779,7 @@ static int task_numa_migrate(struct task_struct *p)
18081779
env.dist = dist;
18091780
env.dst_nid = nid;
18101781
update_numa_stats(&env.dst_stats, env.dst_nid);
1811-
if (numa_has_capacity(&env))
1812-
task_numa_find_cpu(&env, taskimp, groupimp);
1782+
task_numa_find_cpu(&env, taskimp, groupimp);
18131783
}
18141784
}
18151785

0 commit comments

Comments
 (0)