All of lore.kernel.org
 help / color / mirror / Atom feed
From: riel@redhat.com
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mgorman@suse.de, mingo@kernel.org,
	vincent.guittot@linaro.org, Morten.Rasmussen@arm.com,
	nicolas.pitre@linaro.org, efault@gmx.de
Subject: [PATCH 1/2] sched,numa: fix off-by-one in capacity check
Date: Mon,  4 Aug 2014 13:23:27 -0400	[thread overview]
Message-ID: <1407173008-9334-2-git-send-email-riel@redhat.com> (raw)
In-Reply-To: <1407173008-9334-1-git-send-email-riel@redhat.com>

From: Rik van Riel <riel@redhat.com>

Commit a43455a1d572daf7b730fe12eb747d1e17411365 ensures that
task_numa_migrate will call task_numa_compare on the preferred
node all the time, even when the preferred node has no free capacity.

This could lead to a performance regression if nr_running == capacity
on both the source and the destination node. This can be avoided by
also checking for nr_running == capacity on the source node, which is
one stricter than checking .has_free_capacity.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index bfa3c86..678ed03 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1206,7 +1206,7 @@ static void task_numa_compare(struct task_numa_env *env,
 
 	if (!cur) {
 		/* Is there capacity at our destination? */
-		if (env->src_stats.has_free_capacity &&
+		if (env->src_stats.nr_running <= env->src_stats.task_capacity &&
 		    !env->dst_stats.has_free_capacity)
 			goto unlock;
 
-- 
1.9.3


  reply	other threads:[~2014-08-04 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 17:23 [PATCH 0/2] node capacity fixes for NUMA balancing riel
2014-08-04 17:23 ` riel [this message]
2014-08-12 14:53   ` [tip:sched/core] sched/numa: Fix off-by-one in capacity check tip-bot for Rik van Riel
2014-08-04 17:23 ` [PATCH 2/2] sched,numa: fix numa capacity computation riel
2014-08-12 14:53   ` [tip:sched/core] sched/numa: Fix " tip-bot for Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407173008-9334-2-git-send-email-riel@redhat.com \
    --to=riel@redhat.com \
    --cc=Morten.Rasmussen@arm.com \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.