Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1240307pxu; Mon, 23 Nov 2020 15:40:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyucudo+AGNyTqaaxXr7BPRPpJ2+zwtKgDQ9wr4JqsFlPpHGmxuqgyKQJKwHKWYHIOLbvJF X-Received: by 2002:a17:906:9414:: with SMTP id q20mr1787604ejx.384.1606174836645; Mon, 23 Nov 2020 15:40:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174836; cv=none; d=google.com; s=arc-20160816; b=sjP+Cvam+ui6wr0p0ASexTWU7Ojf8z9frccuXNrwD93Xkl+jexs8fSosm9ifjqD33y rUzdmvbbxiJJHx9Ew2pyIVeNe2/KdEvr5Z8PpiE3HBFSgFxeSxmlgYGemlDGvYax8Dx7 BcxF4DmU9W9SlbUDzA+8r33ObLyD8LduwzjApR5nFPyn0HsYmks85St5HBOOGT2SZSA9 Tr040Cl2cA9o7DESLjtIHZDvF0Ri7pETlDIVFf3pjfWVvvFEuS4CNFGipXXUlG8cgZOH sQgIN3TyPs7hLqCjIfDw/oAKYyUCwdpbJ8Gqd6huADEEHbc8U/auspz2a42MfAyWY93A OOaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cN1onCP5+nKsRXAh3R0/vsOOsXaJDsHbJwJ13O44Co8=; b=P47XJ5vJ9xPn7fcKMWKHd3Utb03TXc23N30YphrjpidG3MWJ+wLIHe3kKl1JR52EH5 VVYyRH+jxy+N1t4t3BzlOItldhYHUgfStHx75QFchGJnpRAvV2eZOcppHkkp0rk69hnA AiKkWHcuxoPuZTnS3FXkc/gIGGrdXuVYmIBr7makmNZMGK6RParIhIPTNE5dhT4Jb5pE 5y/fU5vV/AiWIH4Of4HkNjpPMH/jYHCPhHYbaaqrwe0WsqdLfXOxPXWXaOnYXbPf2x4e XZlELCCQ8zsJG3itnJQl4Q+jr+wwCJNPqN5WCRK4VFMXAtOsgRydi8YTnS2JmuyPbNI6 /Y7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hpBTK4eM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb18si8141345ejb.284.2020.11.23.15.40.14; Mon, 23 Nov 2020 15:40:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hpBTK4eM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732966AbgKWMmr (ORCPT + 99 others); Mon, 23 Nov 2020 07:42:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:54108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732607AbgKWMlG (ORCPT ); Mon, 23 Nov 2020 07:41:06 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45B3E20732; Mon, 23 Nov 2020 12:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135265; bh=0hvS3SBApzgsAyvRK+olxZamNr3ivgLb6WJc8oClCv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpBTK4eMF3YGlOtIpVVJenQZWRrMTfAoIxsFvsdyeMfFdjhABamlikU8DzGx/ELC+ RaI+VRe2dKC2pC4OhCRfHX9t72RHAUIOemD2J3TC2p1GXVGJTJQSFDRmi1AoKDjGNQ +3oB++BV+l91vBiW3ZiafY5R587Jlu4Z8MfKUp60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rick Yiu , Quentin Perret , "Peter Zijlstra (Intel)" , Vincent Guittot , Valentin Schneider Subject: [PATCH 5.4 158/158] sched/fair: Fix overutilized update in enqueue_task_fair() Date: Mon, 23 Nov 2020 13:23:06 +0100 Message-Id: <20201123121827.556725409@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quentin Perret commit 8e1ac4299a6e8726de42310d9c1379f188140c71 upstream. enqueue_task_fair() attempts to skip the overutilized update for new tasks as their util_avg is not accurate yet. However, the flag we check to do so is overwritten earlier on in the function, which makes the condition pretty much a nop. Fix this by saving the flag early on. Fixes: 2802bf3cd936 ("sched/fair: Add over-utilization/tipping point indicator") Reported-by: Rick Yiu Signed-off-by: Quentin Perret Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Vincent Guittot Reviewed-by: Valentin Schneider Link: https://lkml.kernel.org/r/20201112111201.2081902-1-qperret@google.com Signed-off-by: Greg Kroah-Hartman --- kernel/sched/fair.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5228,6 +5228,7 @@ enqueue_task_fair(struct rq *rq, struct struct cfs_rq *cfs_rq; struct sched_entity *se = &p->se; int idle_h_nr_running = task_has_idle_policy(p); + int task_new = !(flags & ENQUEUE_WAKEUP); /* * The code below (indirectly) updates schedutil which looks at @@ -5299,7 +5300,7 @@ enqueue_throttle: * into account, but that is not straightforward to implement, * and the following generally works well enough in practice. */ - if (flags & ENQUEUE_WAKEUP) + if (!task_new) update_overutilized_status(rq); }