Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp117714ybm; Tue, 26 May 2020 12:12:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcui1BMGAivD3YMapLSs0VubCaQ5OxWeV5q0tMlr6ek2KXAYNnF4WpGXzT2kzrX8V0c2rt X-Received: by 2002:a05:6402:1bd9:: with SMTP id ch25mr20434999edb.15.1590520367113; Tue, 26 May 2020 12:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590520367; cv=none; d=google.com; s=arc-20160816; b=fic8Na0TEO2v1Ry0NUvU3yKOwEFlyKqsaxggqWtCpytGCO645YdBqeK29LyjGpeF9V gco401qwGU7+NtmBCCNenuhFTXMnUYHMIXh4kDoay7ov1qCZpjrPgOCz7/BkOF7x3dq/ CBsfv32/U0pw+NvGt/w4igICLHHI6GvKl1A+42yA2TqOFMnbWRpEtoCuhB6X0ahNHtra lIv64GFOGFpH8PSP8d9T/pNtsgydLmFrpHIPIlbWL609jN0TgnQzW4SmF+zct2jjEOgy 4724yMy6Bbmvg3cIeUkJijil6wzJf4Z5aMlT7lHuky+ROlXb5eVUJ1nTmxH1eWFvIGya j9aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nv3/cRrFhQWGx8g5N9r3tnd9aUj6/YTkYSb8colGyM0=; b=EyyHoubHbLomfF32H4kIe87XJ63LNbskHYYAg+eQT53sUfEv5L9wpV/ZUn6aaPpQG+ O7L8GqVweNgO4tPEMXKHVYZPgEX003F78cJ5gNfMmCu3GNoZadHqFQrSK0oE5EDvsByE GCYdG1k/lmHwQlMWatQT7uB95l5HBjksL5BmloLjRUA0iLClxWwN8RYvmI3n/Wz5ICbE uc1BrFBz5/ermsJfrW+OobLWZrwqB0JdKfN+umgmlmr8eTmZsvdo3OFXur2pa/vU0vl5 BLHR/Fx2l62JpXY24YV0d5yI+5Q+ZwHCdzfK/BmAN+6hSObKK0T950dAjdIppXVy3Zkb B6BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="WscNLrP/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si432388edu.275.2020.05.26.12.12.24; Tue, 26 May 2020 12:12:47 -0700 (PDT) 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=@kernel.org header.s=default header.b="WscNLrP/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391332AbgEZTKs (ORCPT + 99 others); Tue, 26 May 2020 15:10:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:39912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391452AbgEZTKk (ORCPT ); Tue, 26 May 2020 15:10:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 09DED20776; Tue, 26 May 2020 19:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590520239; bh=clFe/GQAHqSYLypx5ztprUXZNyS6D9G3lry4dPZ7X4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WscNLrP/fM/mbveq3uPcnByykBWcqspyX2QxhOoKdcYWimWumWBHaJMDV/Ow6aM9G C6KIx1+2JB+GQvPWDU1wz4xusueB577swrRC2fyvVzGjybSRIaBIeCCuOtGZpxq1ct ZwPwSeUW0fS8OQ3nNhKIjzk7a9aHs8bLPr9is+Ug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Guittot , Phil Auld , "Peter Zijlstra (Intel)" , Dietmar Eggemann , Sasha Levin Subject: [PATCH 5.4 111/111] sched/fair: Fix enqueue_task_fair() warning some more Date: Tue, 26 May 2020 20:54:09 +0200 Message-Id: <20200526183943.413814507@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526183932.245016380@linuxfoundation.org> References: <20200526183932.245016380@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phil Auld [ Upstream commit b34cb07dde7c2346dec73d053ce926aeaa087303 ] sched/fair: Fix enqueue_task_fair warning some more The recent patch, fe61468b2cb (sched/fair: Fix enqueue_task_fair warning) did not fully resolve the issues with the rq->tmp_alone_branch != &rq->leaf_cfs_rq_list warning in enqueue_task_fair. There is a case where the first for_each_sched_entity loop exits due to on_rq, having incompletely updated the list. In this case the second for_each_sched_entity loop can further modify se. The later code to fix up the list management fails to do what is needed because se does not point to the sched_entity which broke out of the first loop. The list is not fixed up because the throttled parent was already added back to the list by a task enqueue in a parallel child hierarchy. Address this by calling list_add_leaf_cfs_rq if there are throttled parents while doing the second for_each_sched_entity loop. Fixes: fe61468b2cb ("sched/fair: Fix enqueue_task_fair warning") Suggested-by: Vincent Guittot Signed-off-by: Phil Auld Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dietmar Eggemann Reviewed-by: Vincent Guittot Link: https://lkml.kernel.org/r/20200512135222.GC2201@lorien.usersys.redhat.com Signed-off-by: Sasha Levin --- kernel/sched/fair.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 42cc3de24dcc..193b6ab74d7f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5254,6 +5254,13 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) /* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled(cfs_rq)) goto enqueue_throttle; + + /* + * One parent has been throttled and cfs_rq removed from the + * list. Add it back to not break the leaf list. + */ + if (throttled_hierarchy(cfs_rq)) + list_add_leaf_cfs_rq(cfs_rq); } enqueue_throttle: -- 2.25.1