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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 2FF2DC3B1B0 for ; Fri, 14 Feb 2020 17:42:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0635B206B6 for ; Fri, 14 Feb 2020 17:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581702143; bh=Srs9+yc0o/XT+FN6YHGUoe6mlRHFCPi0IL/RpXDaEOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SrvprjwrQlAKWoITHrlnB5gNy4SJVWoA+i2bnOFLSp6iA4BZqJ0G0lUT10PzkvhPe ilnF2eVL3z/VgZwNpAeID+/8WPBQ8DCqppUzAI6QJqkAnOtDLbSSIVOjq7Z93Ydgb8 vcXBrNh8HwuZDoLF/A/edh+VrOr3rlnbE3tcw1sY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389640AbgBNRmW (ORCPT ); Fri, 14 Feb 2020 12:42:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:50574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389230AbgBNQD1 (ORCPT ); Fri, 14 Feb 2020 11:03:27 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9FFB624681; Fri, 14 Feb 2020 16:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581696207; bh=Srs9+yc0o/XT+FN6YHGUoe6mlRHFCPi0IL/RpXDaEOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xU9/UOrokDHrHez8jSgvnM1uXt8FsGLbsG7DYGoZiMbN4IO3SPjoKZvS5eS4Xbyan qVyEAqUBWhaw3P9/lKCsw4swmFDFP6in82FYowvmY6iG2gfaGuX1APncpzLsPOf/U5 3SfeTLFIKJZsrrOGasD1OX3mXTNQ4AfOCI4LNgow= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Qais Yousef , Doug Smythies , Peter Zijlstra , Sasha Levin Subject: [PATCH AUTOSEL 5.4 072/459] sched/uclamp: Fix a bug in propagating uclamp value in new cgroups Date: Fri, 14 Feb 2020 10:55:22 -0500 Message-Id: <20200214160149.11681-72-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214160149.11681-1-sashal@kernel.org> References: <20200214160149.11681-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Qais Yousef [ Upstream commit 7226017ad37a888915628e59a84a2d1e57b40707 ] When a new cgroup is created, the effective uclamp value wasn't updated with a call to cpu_util_update_eff() that looks at the hierarchy and update to the most restrictive values. Fix it by ensuring to call cpu_util_update_eff() when a new cgroup becomes online. Without this change, the newly created cgroup uses the default root_task_group uclamp values, which is 1024 for both uclamp_{min, max}, which will cause the rq to to be clamped to max, hence cause the system to run at max frequency. The problem was observed on Ubuntu server and was reproduced on Debian and Buildroot rootfs. By default, Ubuntu and Debian create a cpu controller cgroup hierarchy and add all tasks to it - which creates enough noise to keep the rq uclamp value at max most of the time. Imitating this behavior makes the problem visible in Buildroot too which otherwise looks fine since it's a minimal userspace. Fixes: 0b60ba2dd342 ("sched/uclamp: Propagate parent clamps") Reported-by: Doug Smythies Signed-off-by: Qais Yousef Signed-off-by: Peter Zijlstra (Intel) Tested-by: Doug Smythies Link: https://lore.kernel.org/lkml/000701d5b965$361b6c60$a2524520$@net/ Signed-off-by: Sasha Levin --- kernel/sched/core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8dacda4b03627..00743684a549a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7090,6 +7090,12 @@ static int cpu_cgroup_css_online(struct cgroup_subsys_state *css) if (parent) sched_online_group(tg, parent); + +#ifdef CONFIG_UCLAMP_TASK_GROUP + /* Propagate the effective uclamp value for the new group */ + cpu_util_update_eff(css); +#endif + return 0; } -- 2.20.1