From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760186AbbBILlZ (ORCPT ); Mon, 9 Feb 2015 06:41:25 -0500 Received: from mail.emea.novell.com ([130.57.118.101]:54325 "EHLO mail.emea.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750916AbbBILlY convert rfc822-to-8bit (ORCPT ); Mon, 9 Feb 2015 06:41:24 -0500 Message-Id: <54D8AAEF020000780005E2B8@mail.emea.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.0.1 Date: Mon, 09 Feb 2015 11:41:19 +0000 From: "Jan Beulich" To: "Peter Zijlstra" , "Ingo Molnar" Cc: , , , , Subject: Re: [tip:sched/urgent] sched/fair: Avoid using uninitialized variable in preferred_group_nid() References: <54C2139202000078000588F7@mail.emea.novell.com> <54C9044B020000780005A5E6@mail.emea.novell.com> <20150128153754.GG23038@twins.programming.kicks-ass.net> <20150209082115.GA32322@gmail.com> <20150209113727.GS5029@twins.programming.kicks-ass.net> In-Reply-To: <20150209113727.GS5029@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> On 09.02.15 at 12:37, wrote: > 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. It's perfectly fine to add it. Jan > --- > Subject: sched/numa: Avoid some pointless iterations > From: Jan Beulich > 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 > Signed-off-by: Peter Zijlstra (Intel) > --- > 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;