From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D826C47253 for ; Fri, 1 May 2020 13:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40DA3205C9 for ; Fri, 1 May 2020 13:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588341049; bh=Yj53TDZGyhIVReXyvNdN+DVUhHo/t6zGJIeir/EWXzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JxDeCSC4C5DG4dN/aippYwWV2fuoj+91w2pv4VdJxfoD22pS355yMZyARl4GSp6Vt 3ntvcfVHXbeS9xJDLcrz8J7tRvY7j2e3n6aUmg/WY7lmR3R8Hx8uL7wns+Xm4R2EQD hZUiJy2oYT8+rfWmFUq7E1DRcReT/GNcchisQ/Ks= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731190AbgEANja (ORCPT ); Fri, 1 May 2020 09:39:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:39166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729798AbgEANj1 (ORCPT ); Fri, 1 May 2020 09:39:27 -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 CDC1020757; Fri, 1 May 2020 13:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340366; bh=Yj53TDZGyhIVReXyvNdN+DVUhHo/t6zGJIeir/EWXzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I8yCSMlbma2KQvMts741ai1fAS+6kNjkEBA5dGcgvQ2G+zdxHE4kXi22cL68kQ0oM e4+/CAmRJtR3yhn+WMnOqYrIO7Vevg3uFzjHZec6C3FYZnixZaeDr+I9Ou6i/2xKBT hjLDExkrnJ2WDVH+LNegD9GZ5sfqcmdKnCO5y4UE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chitti Babu Theegala , Quentin Perret , "Peter Zijlstra (Intel)" , Patrick Bellasi , Dietmar Eggemann Subject: [PATCH 5.4 41/83] sched/core: Fix reset-on-fork from RT with uclamp Date: Fri, 1 May 2020 15:23:20 +0200 Message-Id: <20200501131535.781214366@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131524.004332640@linuxfoundation.org> References: <20200501131524.004332640@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: Quentin Perret commit eaf5a92ebde5bca3bb2565616115bd6d579486cd upstream. uclamp_fork() resets the uclamp values to their default when the reset-on-fork flag is set. It also checks whether the task has a RT policy, and sets its uclamp.min to 1024 accordingly. However, during reset-on-fork, the task's policy is lowered to SCHED_NORMAL right after, hence leading to an erroneous uclamp.min setting for the new task if it was forked from RT. Fix this by removing the unnecessary check on rt_task() in uclamp_fork() as this doesn't make sense if the reset-on-fork flag is set. Fixes: 1a00d999971c ("sched/uclamp: Set default clamps for RT tasks") Reported-by: Chitti Babu Theegala Signed-off-by: Quentin Perret Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Patrick Bellasi Reviewed-by: Dietmar Eggemann Link: https://lkml.kernel.org/r/20200416085956.217587-1-qperret@google.com Signed-off-by: Greg Kroah-Hartman --- kernel/sched/core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1233,13 +1233,8 @@ static void uclamp_fork(struct task_stru return; for_each_clamp_id(clamp_id) { - unsigned int clamp_value = uclamp_none(clamp_id); - - /* By default, RT tasks always get 100% boost */ - if (unlikely(rt_task(p) && clamp_id == UCLAMP_MIN)) - clamp_value = uclamp_none(UCLAMP_MAX); - - uclamp_se_set(&p->uclamp_req[clamp_id], clamp_value, false); + uclamp_se_set(&p->uclamp_req[clamp_id], + uclamp_none(clamp_id), false); } }