Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp412557ybi; Fri, 21 Jun 2019 01:43:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBlVVAoZUwIeSaR40PtIkK1l97dwqyQQ7kPOkQPR49EEanHJm3qZ89Vlm7XGtFhlriZPLT X-Received: by 2002:a63:2109:: with SMTP id h9mr17363960pgh.51.1561106609858; Fri, 21 Jun 2019 01:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561106609; cv=none; d=google.com; s=arc-20160816; b=llqu8ET6rtp4GQTsgnWTWhQAOc7yJ9Jq5QlJfGwhQ03aQOEzcCGtTPFAuGlUl5z8SB MRdI3xCWRW22TYn55BWsHQucWLVVzUyoFUniLMAFLVpX1G8xNkoOzXSKiEcF3fPDGy55 1czfjRawNC3Er+4EUMkEOo80f3LyAE+b1Vjlv0lqa7TXmz7uJRqv6GACD5DH/fsLwMWB /iEmKAvpc823oTp3V9iBIL27T0+SbA7k6uteZOhAbPwtkKMcwHYbE2zogeq4QkMgTv8m bFgpQvItTJfYQ3zY9YaUq3afJ0tbsdKwRvftJIuFjpcPyhj+B5uEXgtmxS9YuM4928CL 7nQA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xfTJIfJFFJN2ePUG+775T3+US8IgbHAzIfUM0dBltdc=; b=kraOL1fVssr9UHwt0P2p3WwbhOhfRXankU9h1QYe0EHGJOEOoijbBBCU+TyKFSw2aV VB4shliGIE4nylRvPkKLU9FuEjj7wCLVGqX+soN5ECwIqk2QvzYEUQqdCh5eIlzkSum3 ZHV9HL0j0kZFCtVgAM2ojDW5soVJhK0REGqIwu70G8tkZ+AuXy3HRvnhU+vLRNdrZ7fp hFuS6B2lgl59xWJW+2vdovMB6Rfs6a0fPujMfqWVBzGbOHgpiMGpM3dcV5m6mKzpWldo 9rL8h6umQzrrT1lLfw5g1LKew+0ombQxTwwVTQBe3sW6bEhIpuKxPXPviKe7Oy2HX9yL Hlrw== ARC-Authentication-Results: i=1; mx.google.com; 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 cj11si2242228plb.373.2019.06.21.01.43.14; Fri, 21 Jun 2019 01:43:29 -0700 (PDT) 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; 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 S1726643AbfFUImy (ORCPT + 99 others); Fri, 21 Jun 2019 04:42:54 -0400 Received: from foss.arm.com ([217.140.110.172]:50968 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726632AbfFUImx (ORCPT ); Fri, 21 Jun 2019 04:42:53 -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 0A20A150C; Fri, 21 Jun 2019 01:42:53 -0700 (PDT) Received: from e110439-lin.cambridge.arm.com (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A28BE3F246; Fri, 21 Jun 2019 01:42:50 -0700 (PDT) From: Patrick Bellasi To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Paul Turner , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan , Alessio Balsini Subject: [PATCH v10 07/16] sched/core: uclamp: Reset uclamp values on RESET_ON_FORK Date: Fri, 21 Jun 2019 09:42:08 +0100 Message-Id: <20190621084217.8167-8-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190621084217.8167-1-patrick.bellasi@arm.com> References: <20190621084217.8167-1-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A forked tasks gets the same clamp values of its parent however, when the RESET_ON_FORK flag is set on parent, e.g. via: sys_sched_setattr() sched_setattr() __sched_setscheduler(attr::SCHED_FLAG_RESET_ON_FORK) the new forked task is expected to start with all attributes reset to default values. Do that for utilization clamp values too by checking the reset request from the existing uclamp_fork() call which already provides the required initialization for other uclamp related bits. Signed-off-by: Patrick Bellasi Cc: Ingo Molnar Cc: Peter Zijlstra --- kernel/sched/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7d4272440890..2c49b23efc87 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1071,6 +1071,14 @@ static void uclamp_fork(struct task_struct *p) for_each_clamp_id(clamp_id) p->uclamp[clamp_id].active = false; + + if (likely(!p->sched_reset_on_fork)) + return; + + for_each_clamp_id(clamp_id) { + uclamp_se_set(&p->uclamp_req[clamp_id], + uclamp_none(clamp_id), false); + } } static void __init init_uclamp(void) -- 2.21.0