Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp366647yba; Wed, 15 May 2019 02:49:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/h9qsUizv4Hx+E5Ehixm+CIAL4wkFntLwLaqr35mDTEtQ6vTeFH32N0Dm54BeFPyfWUQF X-Received: by 2002:a62:75c6:: with SMTP id q189mr45256396pfc.98.1557913754905; Wed, 15 May 2019 02:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557913754; cv=none; d=google.com; s=arc-20160816; b=wXszIDdwC4x9svFTN9LAnl1QBf7DAnQe0aUKc2UjACjCRkC12CGwF7j1VmCiSIfkzQ 920kYrN9Co+Mdf+A+ta9DaNPtKXCtLxaHVh/bEmH2hhrmfX5fkswLKUaD+Vw2SeQSI+P v3l0DM0SMXrR7WuLZFXRGFLssCca541ZY3tRk0cwHDKdtOzUg8MrOxiozyghG9Lg6vHT C7shikSMU6zefm4B0ORzAJfl8QMLWq9S8pmOecv2HN9m9fXNCjERPcyYn4xLy9nyhpi5 xzpu26jKBV2IZeeKtOXyIewPfkou8d0El2gicCIkIopSRg3abLrHwKt0D7dtm1ptUXwf IIPA== 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=IoMROgT4Tf3N8NdRrJThQLzoKM1ggSsIhT2zXNcFKyo=; b=UpSQv7EXk7IjYMcrMY9/B0KXVyRV175vs/gUjMN4ZGL2ENpIgP/MWMAX7MCsen2ejV 80UQ6bkiRilg6zU/N4cxZ3tehsAkJiQ/hvJWStLCMgC3IUvXLdV9n/Kqe5I/BD7tztod 5jQAkEo6j6AnAftNUcKZ2mK+a2ZAbURecxJHHaHcNqJ2mIcsGdX+JLELtMYuUK8kZv7r Sx1RoeTG8YrBYUbsLrzE/4z8T0Lcuf+NhhcnaMOrbZloGBhC1O4RSUogmr1qwls5SCxP 8O2pjMgM75NE0464yyFhfw14AwVBqIKt/rqgb+wuob8kp1T049ssA+4JuordHzhhYEm4 tt4A== 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 a10si1426227pgw.90.2019.05.15.02.49.00; Wed, 15 May 2019 02:49:14 -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 S1726669AbfEOJp6 (ORCPT + 99 others); Wed, 15 May 2019 05:45:58 -0400 Received: from foss.arm.com ([217.140.101.70]:39338 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbfEOJpz (ORCPT ); Wed, 15 May 2019 05:45:55 -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 42313A78; Wed, 15 May 2019 02:45:55 -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 21BE73F703; Wed, 15 May 2019 02:45:51 -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 v9 07/16] sched/core: uclamp: Reset uclamp values on RESET_ON_FORK Date: Wed, 15 May 2019 10:44:50 +0100 Message-Id: <20190515094459.10317-8-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515094459.10317-1-patrick.bellasi@arm.com> References: <20190515094459.10317-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 3e035fbb187d..03b1cd82bc48 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1070,6 +1070,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