linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Jan Beulich <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, JBeulich@suse.com, jbeulich@suse.com,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com
Subject: [tip:sched/core] sched/numa: Avoid some pointless iterations
Date: Wed, 18 Feb 2015 09:10:29 -0800	[thread overview]
Message-ID: <tip-890a5409f9d0c84d75a1e16eebdfe91d8a57ef1e@git.kernel.org> (raw)
In-Reply-To: <20150209113727.GS5029@twins.programming.kicks-ass.net>

Commit-ID:  890a5409f9d0c84d75a1e16eebdfe91d8a57ef1e
Gitweb:     http://git.kernel.org/tip/890a5409f9d0c84d75a1e16eebdfe91d8a57ef1e
Author:     Jan Beulich <JBeulich@suse.com>
AuthorDate: Mon, 9 Feb 2015 12:30:00 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 18 Feb 2015 16:18:02 +0100

sched/numa: Avoid some pointless iterations

Commit 81907478c431 ("sched/fair: Avoid using uninitialized variable
in preferred_group_nid()") unconditionally initializes max_group with
NODE_MASK_NONE, this means that when !max_faults (max_group didn't get
set), we'll now continue the iteration with an empty mask.

Which in turn makes the actual body of the loop go away, so we'll just
iterate until completion; short circuit this by breaking out of the
loop as soon as this would happen.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150209113727.GS5029@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/fair.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 28cbaca..ee595ef 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1774,6 +1774,8 @@ static int preferred_group_nid(struct task_struct *p, int nid)
 			}
 		}
 		/* Next round, evaluate the nodes within max_group. */
+		if (!max_faults)
+			break;
 		nodes = max_group;
 	}
 	return nid;

      parent reply	other threads:[~2015-02-18 17:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  8:25 sched/fair: avoid using uninitialized variable in preferred_group_nid() Jan Beulich
2015-01-23  9:54 ` Peter Zijlstra
2015-01-23 10:01   ` Jan Beulich
2015-01-28 14:29 ` [tip:sched/urgent] sched/fair: Avoid " tip-bot for Jan Beulich
2015-01-28 14:46   ` Jan Beulich
2015-01-28 15:37     ` Peter Zijlstra
2015-02-09  8:21       ` Ingo Molnar
2015-02-09 11:37         ` Peter Zijlstra
2015-02-09 11:41           ` Jan Beulich
2015-02-18 17:10           ` tip-bot for Jan Beulich [this message]

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=tip-890a5409f9d0c84d75a1e16eebdfe91d8a57ef1e@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=JBeulich@suse.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).