Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp677921ybv; Thu, 13 Feb 2020 07:37:18 -0800 (PST) X-Google-Smtp-Source: APXvYqz768xKgZDVUC0AFAPiMuWXFRu7rWjjym3+oZZOC9mWApADsjFJt4pAT3yUv3DERNivOb9K X-Received: by 2002:aca:ac10:: with SMTP id v16mr3130882oie.123.1581608238176; Thu, 13 Feb 2020 07:37:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608238; cv=none; d=google.com; s=arc-20160816; b=tnlCo7qKpnFMHlriMTDBjkswEFoxmK9UKeHSVJ4rhL0yq0Xk++t8UU7lVuWqVWpYzy qBAP7yAtUv8wddFK5Qa5rqx8rYZJ1vtV6A6YIyy/+BiIVuCHuJKNPYx8Le3NM+tTsf/L GwLXQ8K5R/vIJh4bKjNMXJQdr6mxZonnViCfIw3/5/m+9DY8eUaUdF0lKKMQrT3bKPbW VZT+AdBOEQM74uJz2pwIFbpC06XnMGbEH9W9XB27zlS6NRNvLdfMWb742TUfZhUiRdQt aCl8Addp6RhkIxBn9YuMf6LFIZ5PXfsmqsenXc6V6dPy76UucENaHgZ/IpfnzXNFnIlD BSAw== 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=yvGvvmbUCFyk9U9Xz8qUgNwz60SW1s8JWJRRJMMADeI=; b=ZGYNscArESz/fXrS96thuA+DEosmDGOO+n3atHlmVyo3FJAeTiSSRtM2Z+etIkF1Ds fZietqGVIkA75vUJRMeZxaggDhyVxaIxIN8cO5ApSeCtj7BLhdSPSuu+CJ7TP/WtlZcQ Rgo85IQkoV8V0MI0Mc2CFDn7q6dO+sp+M0Kv8e7d0j0fDeZOcbaKNrf1ekIOyZaf11Lu pOzbG1rpgjtCRK4hup9h+y5gji27OCWsHXy3P79tg0+9KQEM7wP6tLnFxJVLeC6k5RG4 bZaLBksE416/CFRsPkMmlLs56VMEZsGhHRvJHXCq7BwuPErhTjmC87P/qxp7/ZFhmAqs RnxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eYXf8AMP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si1264072otv.149.2020.02.13.07.37.05; Thu, 13 Feb 2020 07:37:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eYXf8AMP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387997AbgBMPbE (ORCPT + 99 others); Thu, 13 Feb 2020 10:31:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:52168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729483AbgBMP1n (ORCPT ); Thu, 13 Feb 2020 10:27:43 -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 64014222C2; Thu, 13 Feb 2020 15:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607662; bh=qtD4kttmnNspxcI9KmmiufATSWlPGV+r4mNd/jnyryw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYXf8AMP0v49S4lFWNaVjz7UJzcnwgmngwtglpSUwVXl/dscV2UL/VJxE2wxw365R Slih14ANWQI3fn7Uo/DQSRHQtm/kgs7zwqwjTfAupZPXMSRWH9XjS5Zbtldk7dbM3o c+Gy2QuIqZEpGcrOjH909kAzlsttdkLQCczFmlt4= 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.4 64/96] sched/uclamp: Fix a bug in propagating uclamp value in new cgroups Date: Thu, 13 Feb 2020 07:21:11 -0800 Message-Id: <20200213151903.707374301@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@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: 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 @@ -7090,6 +7090,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; }