linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Jan Beulich <JBeulich@suse.com>,
	tglx@linutronix.de, torvalds@linux-foundation.org,
	riel@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com
Subject: Re: [tip:sched/urgent] sched/fair:  Avoid using uninitialized variable in preferred_group_nid()
Date: Mon, 9 Feb 2015 12:37:27 +0100	[thread overview]
Message-ID: <20150209113727.GS5029@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20150209082115.GA32322@gmail.com>

On Mon, Feb 09, 2015 at 09:21:15AM +0100, Ingo Molnar wrote:
> Ok, agreed, please send a separate patch to fix this.

Jan, I didn't want to put your SoB on without feedback, holler and I'll
amend it any way you like.

---
Subject: sched/numa: Avoid some pointless iterations
From: Jan Beulich <JBeulich@suse.com>
Date: Mon Feb  9 12:30:00 CET 2015

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.

Maybe-Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/sched/fair.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1763,6 +1763,8 @@ static int preferred_group_nid(struct ta
 			}
 		}
 		/* Next round, evaluate the nodes within max_group. */
+		if (!max_faults)
+			break;
 		nodes = max_group;
 	}
 	return nid;

  reply	other threads:[~2015-02-09 11:37 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 [this message]
2015-02-09 11:41           ` Jan Beulich
2015-02-18 17:10           ` [tip:sched/core] sched/numa: Avoid some pointless iterations tip-bot for Jan Beulich

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=20150209113727.GS5029@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=JBeulich@suse.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=riel@redhat.com \
    --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).