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=unavailable 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 DD75FC3B189 for ; Thu, 13 Feb 2020 15:39:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB6052468A for ; Thu, 13 Feb 2020 15:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581608365; bh=hgS5iMbB3/SY2x/9uvJwBtsYpyv2xzbjtqpk/MDAnKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Dzt6fZCtdT/mACL3p/jB9/9bu2GmsOShVKE3WMxwayg9DSqKrQkcqIFey5EqABVzl PP87iKPRXWyDig4c74401Ny4afkJGbZenMVE3JK6exJGWX/YOTcEG0MOVjS3pQxstc r693Lr35+/U7Nesa8pFxgDISMrAzqF+8jBqglU5k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729655AbgBMP3D (ORCPT ); Thu, 13 Feb 2020 10:29:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:57966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729647AbgBMP3C (ORCPT ); Thu, 13 Feb 2020 10:29:02 -0500 Received: from localhost (unknown [104.132.1.104]) (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 33DD4218AC; Thu, 13 Feb 2020 15:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607742; bh=hgS5iMbB3/SY2x/9uvJwBtsYpyv2xzbjtqpk/MDAnKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMl9k6hF+hR81MNahs4TZOTX6X7wnt8xjUQ2j/4bHTQ03iZyWxHHQXet0lGvNO8MK TYKNlLcgbVS3jZZD0GzO4VTmldFs/zXoxg2YHKuisy6mAob09GtS+MZ1gSp0smw3uI b3r7q+qhCXK014fYflkBOo1hS3T/ZzJoginxAWvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Smythies , Qais Yousef , "Peter Zijlstra (Intel)" Subject: [PATCH 5.5 079/120] sched/uclamp: Fix a bug in propagating uclamp value in new cgroups Date: Thu, 13 Feb 2020 07:21:15 -0800 Message-Id: <20200213151928.089549500@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151901.039700531@linuxfoundation.org> References: <20200213151901.039700531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Qais Yousef commit 7226017ad37a888915628e59a84a2d1e57b40707 upstream. 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: Greg Kroah-Hartman --- kernel/sched/core.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7100,6 +7100,12 @@ static int cpu_cgroup_css_online(struct 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; }