Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1504383ybz; Thu, 16 Apr 2020 10:18:10 -0700 (PDT) X-Google-Smtp-Source: APiQypITL1MnKnV3+nqyoKJemHrGvFfGOZV2xUV4kI2jMa/mWyvkC/DfOAFRkaQKX7l2N6YaUHda X-Received: by 2002:aa7:d0d6:: with SMTP id u22mr15243779edo.262.1587057490636; Thu, 16 Apr 2020 10:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587057490; cv=none; d=google.com; s=arc-20160816; b=gmrKm1N61EKNV+jCfCHqAClnG/vhg6mrRKHvgddw5WpIdMRL4ALmFMzWOsQ+YE5qT0 PvM1d6d6Y5NK4hmL5jtM8cb3RzEOoTMhNMyfdC4oqUmp36HCvlyzoINxdpjRsllLjuNp /FcEZDT8Jm/PzQ06IVjawXjPRI4b6QRXeslWmLDqHxbIIqeNb5sji0ln+f+timVvPUxH q9AMBmw+rjEUny3+Qw2tA2GM7cpA5RieBvF+cARX+Rr26SI9Efe1Erxa3FJWhO/BGFqW Nd/LdtyZ89MU3Qsd65Ldr7sr/XZOq72z8Pn+l4FWkPkrcfMVA/qJnbpClfJGyY+HuE+B bmRQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=bKM5sEhe4Zj9DPsFUQXyKJg6zPiblvZP2c/UkyCupNo=; b=qDbjwnw+2xkwbW3b73WlhlcqIEgHpiZJ5W8RRfpkStdiHaN0PQYslFN/sGuBPzwh6o RZcJ+Kvvv+VIvVTfTP1koF8Sw16mvwf35HJROK8iw2TTNe14cCBQOzpp4U3u30eAO8MI tDM52JWzLKAivlRd3gqPRVR1GL+vdeSM1yvBKNZV+p7N4yu0z5IN6ujoUBEBQvab2Z4d itY/fUcSjrm+rOIrq1U4yD3vsQ+IEFWOBfL4m3g2OKHJEiLuCxGOT0rK8RgqV3wvwLOc 3sRqoXRowNC239vrTb+bOrIq1zqJUWrkgnkyKr4QUIsC7SWSYwqrofIfOjtnHJR0nYFN Awhg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si9609176edw.490.2020.04.16.10.17.47; Thu, 16 Apr 2020 10:18:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505973AbgDPLHR (ORCPT + 99 others); Thu, 16 Apr 2020 07:07:17 -0400 Received: from foss.arm.com ([217.140.110.172]:58872 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2506009AbgDPLDV (ORCPT ); Thu, 16 Apr 2020 07:03:21 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5631A113E; Thu, 16 Apr 2020 04:03:20 -0700 (PDT) Received: from [192.168.1.19] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9587E3F73D; Thu, 16 Apr 2020 04:03:17 -0700 (PDT) Subject: Re: [PATCH v2] sched/core: Fix reset-on-fork from RT with uclamp To: Quentin Perret , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: 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, kernel-team@android.com References: <20200416085956.217587-1-qperret@google.com> From: Dietmar Eggemann Message-ID: Date: Thu, 16 Apr 2020 13:03:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200416085956.217587-1-qperret@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.04.20 10:59, Quentin Perret wrote: > 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); > } > } LGTM. Reviewed-by: Dietmar Eggemann