Received: by 10.192.165.148 with SMTP id m20csp1967406imm; Thu, 26 Apr 2018 04:50:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Iat9UK624uZPg0uemqqtQr9L/XGA/i/oxvBbdhWdxzgS7P77xSMQfjyLJHPIVAGR6vQdE X-Received: by 10.99.144.196 with SMTP id a187mr26967268pge.189.1524743413544; Thu, 26 Apr 2018 04:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524743413; cv=none; d=google.com; s=arc-20160816; b=x/fiTaqsRUIUhHll/edgJ4siF/iqkqgvkzQ1GBSdfa/vxloDquIvH5c2bhX+5b1zf8 gFENk2ni3ZjV1K0Z02xnBxGnQhCmTTFYg13Fpaq0yLbKTCxoC/Okyx0zIS0tyjDUc0jn ADL/MBD1raLJX/kc4VusNDIRldj84G/4oddZHoscNaOqVlaEhKQESY8LBTops9EcT/GM Sgd64VrzoOc4xjm0DPVuTAJJuaPps97nlRtzUUPrBSDAiXQpX2Wp6iTOo6yfSOIU6Ei8 6Han8s7kxO9CWJz6Qsd9Uubwh8UWzkfQMuro8YFo2S10mwW3cNzqA/5UIANF9ry0+Vtv Pe1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=L8HQGdNdpGR8iuY0ae2O5yH/d9NJt3HNYpc9cepq7es=; b=Iqvpvz98Zo8QIWTbWGxeiQA4SbnGmNRMP6IvilCv/y0wXX+9tSsbllpiWz6NF7FLbC C8jN1Bf2nw+iOCLWZ2F+eGxLN6sBl32Hqvl//cGx2bLA7ozY8/yeHMuJcb/q4W6GIma5 83ltevBHIQeoHPVAHJsK6+qfheM1Fhd5wxSORPcB2a2XsiEJhmbNO+8SOJ+hPUf5nFnP iXAZSIpYNdOOBOUYW/DerzcEILxCH3QU9o03x+0tsgpwkHPBSf9i2wkgt/+2X5AyB00J Wk7MywVEjf3AIeb54txtBCVtKhgd2Zp391h59xkNquerkSn4z+m88psG6MxPx0nBMW/0 A7UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=LiswFT+7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2-v6si1475417plp.316.2018.04.26.04.49.57; Thu, 26 Apr 2018 04:50:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=LiswFT+7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755207AbeDZLst (ORCPT + 99 others); Thu, 26 Apr 2018 07:48:49 -0400 Received: from merlin.infradead.org ([205.233.59.134]:48072 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753942AbeDZLsp (ORCPT ); Thu, 26 Apr 2018 07:48:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=L8HQGdNdpGR8iuY0ae2O5yH/d9NJt3HNYpc9cepq7es=; b=LiswFT+7hjN3SG6iArIvTl6z8E iqtTgukeKLr0aotMcrFH/6g622SaJ4DZQgBOVJSOHgJPLfp/6xiRHCqgkeN7KpZDF72krInZpRpCj sNMRMmEfJnMZcO72jmq/AZveP/qIHpW6Z57ebwJJafnws0z2b/KdOBUyjkj+JMoyFNoGPdkkB7Z1Q 4k9v99/U2nMHZy3tke3LiO4LqB9Y8vPkNlSiOC+GjKbvPQc6ES6iLfmMcg79YK6p+wqedHCMQg8zn t1yCwFnfMXU16jt8yfWyC2CLDSgS6rarR/bcQ5THr6Rq75r/eeK4NF0qS91jDZbDOqB4BvAdZh8p7 61dfMNTw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBfOA-00085I-F3; Thu, 26 Apr 2018 11:48:38 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C9824203BFAEB; Thu, 26 Apr 2018 13:48:35 +0200 (CEST) Date: Thu, 26 Apr 2018 13:48:35 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: Niklas =?iso-8859-1?Q?S=F6derlund?= , Heiner Kallweit , "Paul E. McKenney" , Ingo Molnar , linux-kernel , linux-renesas-soc@vger.kernel.org Subject: Re: Potential problem with 31e77c93e432dec7 ("sched/fair: Update blocked load when newly idle") Message-ID: <20180426114835.GI4064@hirez.programming.kicks-ass.net> References: <20180412111519.GH12256@bigcity.dyn.berto.se> <20180412133031.GA551@linaro.org> <20180412223904.GJ12256@bigcity.dyn.berto.se> <20180420160013.GA13769@linaro.org> <20180422221827.GB27674@bigcity.dyn.berto.se> <20180423095420.GA23995@linaro.org> <20180425225603.GA26177@bigcity.dyn.berto.se> <20180426103133.GA6953@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180426103133.GA6953@linaro.org> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 26, 2018 at 12:31:33PM +0200, Vincent Guittot wrote: > From: Vincent Guittot > Date: Thu, 26 Apr 2018 12:19:32 +0200 > Subject: [PATCH] sched/fair: fix the update of blocked load when newly idle > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > With commit 31e77c93e432 ("sched/fair: Update blocked load when newly idle"), > we release the rq->lock when updating blocked load of idle CPUs. This open > a time window during which another CPU can add a task to this CPU's cfs_rq. > The check for newly added task of idle_balance() is not in the common path. > Move the out label to include this check. Ah quite so indeed. This could result in us running idle even though there is a runnable task around -- which is bad. > Fixes: 31e77c93e432 ("sched/fair: Update blocked load when newly idle") > Reported-by: Heiner Kallweit > Reported-by: Niklas S?derlund > Signed-off-by: Vincent Guittot > --- > 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 0951d1c..15a9f5e 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9847,6 +9847,7 @@ static int idle_balance(struct rq *this_rq, struct rq_flags *rf) > if (curr_cost > this_rq->max_idle_balance_cost) > this_rq->max_idle_balance_cost = curr_cost; > > +out: > /* > * While browsing the domains, we released the rq lock, a task could > * have been enqueued in the meantime. Since we're not going idle, > @@ -9855,7 +9856,6 @@ static int idle_balance(struct rq *this_rq, struct rq_flags *rf) > if (this_rq->cfs.h_nr_running && !pulled_task) > pulled_task = 1; > > -out: > /* Move the next balance forward */ > if (time_after(this_rq->next_balance, next_balance)) > this_rq->next_balance = next_balance;