Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1063083ybz; Thu, 16 Apr 2020 02:03:50 -0700 (PDT) X-Google-Smtp-Source: APiQypKWpzj6SHnLk5eZ1uaKtTzBTIv6Stw1spgJjhAgXRT9AyIXgK/9cetdA6B6QEmLa9cUb7fj X-Received: by 2002:a17:906:4548:: with SMTP id s8mr8533532ejq.349.1587027830247; Thu, 16 Apr 2020 02:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587027830; cv=none; d=google.com; s=arc-20160816; b=SGAsXGzb7Mr1T7NHLhlX36tfY0UF1xs6gHDYN4n2V/i1ZD7TgdxzT6RjfvUGQFtFPv vfpSsv5f2CDJq5O6KsirCtSRIg28U6rQcbZEG7HxOw5Lfc9RRPPnbc6g2qGpD+nUZGOn QXDHa9HlRejheLhafzrToNz91a2S8q0+mU+GfqDkMLChKM0nJ2DtZKVUSKRiHccN2Hxn cBL6dSWLsMbZm2wGRdI5xLRG4kVvEBTB+oLJHTldKgzvADBFDXY9g7MbcXX7hLB3mrX9 dschuNWOT86vzvBYUqBMuFPnp2IqkGkmP/3kax+Ck1rc8bKj/9yDw3AHmyNVRFePUA+p 6ILg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=zYXTZFcfx+3CensArNPFNmiVclp57O43Gn/CFyzw2Uo=; b=oOjBFgixOe0Lb/Bq3BqWZJleoJXdhVbg4THvtpcrt/ZmXazxMdDxNj8i/xvcSsbzoK B0RcdAcXxGe3WVhkpheSfHPVx/UMWZpqWTFreTuv8kS9X6xn/h7tpVyTuebuMyO9Bfxe B981c/GN5GVMBE0CXohcmgP0k3X0x/NYe7ng+Y2G2CgKCFyeeDAzZPu8G05MpZloRluh cNBsW2CKWch1jZUqAu6X4uV1Rqi+pbGJJrKX9YaKzaa/DO7PpAb7NJBBpB918lu4p26B o5inphDu5qWGNg4h9+n7tYasFROQ12Pbgg7K8o719DL3PqRPMULMquAvjFmV/TEAT0Ql Cmqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RKkD22rb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch14si10135698ejb.304.2020.04.16.02.03.26; Thu, 16 Apr 2020 02:03:50 -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=@google.com header.s=20161025 header.b=RKkD22rb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503255AbgDPJC0 (ORCPT + 99 others); Thu, 16 Apr 2020 05:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503156AbgDPJAC (ORCPT ); Thu, 16 Apr 2020 05:00:02 -0400 Received: from mail-wr1-x44a.google.com (mail-wr1-x44a.google.com [IPv6:2a00:1450:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E45BBC061A0C for ; Thu, 16 Apr 2020 02:00:00 -0700 (PDT) Received: by mail-wr1-x44a.google.com with SMTP id p16so1370580wro.16 for ; Thu, 16 Apr 2020 02:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=zYXTZFcfx+3CensArNPFNmiVclp57O43Gn/CFyzw2Uo=; b=RKkD22rb6Dzs2uaucfSqEkzpn0HhEKZCL5xRSJVQRCjvmF6gjSa+MTJl+xlpi2TDkC bQiuk/gS8BfTYSuGBDtYbw+GEivN6EyJLFV2SiilGvCu1pqNlQOvRNYI6O60CX8OhyPc NPUXPobg4JIXNwSCb98uUproTN5H8lF+titV2n6/INf5gA84sJYuhs/XDaurCZscX2IT gCCz1kmvaCdVrYRACn3tCTr7rXBUMZ3I711tDJ8x1WnWn2wfvT7X36NsT0dMDb0fhaq+ FmcLwdqSqkUgiw4K8ICrhiRFrZZ+X16maJxVfuHqp8Y9UtVeNe+AAYfwTTHaG7YU/AmL acfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=zYXTZFcfx+3CensArNPFNmiVclp57O43Gn/CFyzw2Uo=; b=UnFVq/dvWFdk70XE1ySjUMngyR9fPlimJYq8FjMQEzoFi+2JZ7LHCdMbZ0f+AwfOl9 ywa9uFhGx/ND50rFtiCv0Gj/qn+V1gyY/mtsvSxNK2HsFxX4LiSUckKZpiDLiV3FmL98 zLuI8xQYIMF8y6A3uICJgYKrdGiGmylow3hUyBv/x9bLqhmM1WKpmntrbKnKkT+vwjLt v1twOtuKSspwmMOF205tLrNPYp5h1h+hFwFWUFkuApqM8xyrldN3uYpxKbywnqz1mb0p oMKezA2JzKRvrI2XaR5yOBZ5gq5IUQD7jLwj1ZOFuZJEuS5FOgmQ/3whZgxefhem9B8t qSrw== X-Gm-Message-State: AGi0Puba3VlkIioRZqSYeowxK5aVnvpatstC0TFignu+8+6okWgTtmvn UOzpsNdWTX89lg3rRaGU2eZUowiDxJPt X-Received: by 2002:adf:f7c6:: with SMTP id a6mr33267035wrq.193.1587027599379; Thu, 16 Apr 2020 01:59:59 -0700 (PDT) Date: Thu, 16 Apr 2020 09:59:56 +0100 Message-Id: <20200416085956.217587-1-qperret@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog Subject: [PATCH v2] sched/core: Fix reset-on-fork from RT with uclamp From: Quentin Perret To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, ctheegal@codeaurora.org, dianders@chromium.org, patrick.bellasi@matbug.net, valentin.schneider@arm.com, qais.yousef@arm.com, linux-kernel@vger.kernel.org, qperret@google.com, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Patrick Bellasi Signed-off-by: Quentin Perret --- Changes in v2: - Added missing 'Fixes:' tag (Patrick) - Removed unnecessary local variable (Doug, Patrick) --- kernel/sched/core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3a61a3b8eaa9..9a2fbf98fd6f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1232,13 +1232,8 @@ static void uclamp_fork(struct task_struct *p) 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); } } -- 2.26.1.301.g55bc3eb7cb9-goog