Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1164033yba; Tue, 2 Apr 2019 03:43:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQvlwW1rnpOyQ2tUYcQ/XyIc6RDXnbSOSlsJBAbROVQiofKse9OXc8+gX8DltBNTJqaIT0 X-Received: by 2002:a62:26c1:: with SMTP id m184mr38011145pfm.102.1554201831670; Tue, 02 Apr 2019 03:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554201831; cv=none; d=google.com; s=arc-20160816; b=XH83WwLWmzEX/41U1mgFSYO/xNaRvQ+GiGuu2wxSqtWVuhjXycr3q1IjpBDnPAj8Id DQm7VOMMKR8l1/FJvqENRBLag2ObrKESS64tj9CG2huC68u2l4PBHzsYJ0Qo3fO6oEKg cQFFoku7icToTIZT+HSgvIdZFB1t4M/zlWxw+dvwmY7/witk19sUvzyPtGyFmeEKQ4GM VX/0Dq8JgfF10WVG0odEyls5lQXEisQfkXpWUwuz/5Cn9bAmTjT6za6WSZv5SlmlE66p 7fCxH9vTUrJFbmbXTAhazpTSbiGVjyFy83JIJnzIJ/rFxlRDomoJEPcu6Nh8YVF4/gqd sfjw== 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=U0/isluaB+zjgin4kf3WaZr4u0hF0BxZNzqvzpBV/eg=; b=FWT9gisO/H/d1P3Bt3gwsZsAMGMjiaf6aWj09Dm+j9ySQQMvLVA1M6FxlO7WUPLJbk I6Sg/Dpma4STgqMygiu2j/hvtef1TLcfXLt/Fxa+EyIbtDrNmRie1PYwUB4aKiMgZh19 qlJludzDdmRHWIfFIl5ud9/TJ2c6DYgV3+mylWifi4NG8nqKxCnGgWJxyF2X1BgtBt7+ kw4veZjHcTsiDi/YTFbc0NPBr8qT1cLZknJwX3juWUMTUiQlW93djBoTkmeyy+JiVNH0 sJuWPuscVcMEaUsdrr1rtrX9r6jGT5dNiWqXeoYstzMuFIUPIx74IszN2M9tM10uLdaT Rj/A== 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 w19si3806148ply.103.2019.04.02.03.43.36; Tue, 02 Apr 2019 03:43:51 -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 S1730106AbfDBKmo (ORCPT + 99 others); Tue, 2 Apr 2019 06:42:44 -0400 Received: from foss.arm.com ([217.140.101.70]:48394 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729935AbfDBKml (ORCPT ); Tue, 2 Apr 2019 06:42:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A67A168F; Tue, 2 Apr 2019 03:42:41 -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 738323F59C; Tue, 2 Apr 2019 03:42:38 -0700 (PDT) From: Patrick Bellasi To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-api@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 Subject: [PATCH v8 07/16] sched/core: uclamp: Reset uclamp values on RESET_ON_FORK Date: Tue, 2 Apr 2019 11:41:43 +0100 Message-Id: <20190402104153.25404-8-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190402104153.25404-1-patrick.bellasi@arm.com> References: <20190402104153.25404-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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 68aed32e8ec7..bdebdabe9bc4 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1070,6 +1070,17 @@ static void uclamp_fork(struct task_struct *p) for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) p->uclamp[clamp_id].active = false; + + if (likely(!p->sched_reset_on_fork)) + return; + + for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) { + unsigned int clamp_value = uclamp_none(clamp_id); + + p->uclamp_req[clamp_id].user_defined = false; + p->uclamp_req[clamp_id].value = clamp_value; + p->uclamp_req[clamp_id].bucket_id = uclamp_bucket_id(clamp_value); + } } static void __init init_uclamp(void) -- 2.20.1