Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6954913ybh; Thu, 8 Aug 2019 08:09:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqw86YuzCRSgL2guajMGashhHZGJVryNNd7v10N8Zm/+M672ISXbG0N5tdSHat9qMoqWoarW X-Received: by 2002:a63:ee04:: with SMTP id e4mr13140737pgi.53.1565276977182; Thu, 08 Aug 2019 08:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565276977; cv=none; d=google.com; s=arc-20160816; b=vCdQlMh3HHKi/04bE+6uc6E8EAJaKKLrbJkntSB+5wmAtrKRG4bFttBzypCwZ7/+mt 88LiB2UgNStDOci15oV0yGfKz8r7L4VOl10fHsMTvpNAlmzyyZnDJnr/ds1RqY15ZQIZ GYKyUxvPKzelFWioTCsy08D0cgZpEbd+Bp/F6b6roqbN9fO80svKwNkHlMZKx1cKQ6rN LFD77Ok0wvAMZGAYNg1+lsOCoEFL82aCzbuW3J+k0o4q0spav4PRR6vlSjz1NDED/Nvy 5pqxK+6+kthQABgSI0bhaUJdPXyOe5pcWtL8XkyoDgLuGXOGSfoaJ+nGgMXpSWZJOTih Ez3A== 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 :message-id:date:in-reply-to:subject:cc:to:from:user-agent :references; bh=0ts6ZvqjUQJwFkw19z5Ta9DJssSGNIbSuFZXaXcBCOc=; b=wf0gJKRZxsq1tq43Njld1Jc04W65lrEhZ/KDWBmcwjOIW61wo/BlVICNkctUbVSM24 luCIn10ZF/z8eCnTk9j/ur6jkl/94TVGUVwPKGucH/Iz3xmAk8cQJt2Q15xPRe3SA3Pi 5wq+YadnivSQlDaz2QkzUp6MpNpTv1I/4LmLXbbsYNHf+e7yb3BB5cOjDrLBbZtL+6HK 0YMtQn7PutaShWV5EoPNkq226rljg/JjwPiwOI1hXyeUZAAG9dptgcU6gMRGAb5HwrMt 56YxFBE2pthNWK5Xcai0D0mbC3918vcTA+g0Siymydu0hJZ/gPFd0aipotHnSSkvq9rA zrjg== 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 t189si54625705pgt.428.2019.08.08.08.09.21; Thu, 08 Aug 2019 08:09:37 -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 S1732557AbfHHPIZ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 8 Aug 2019 11:08:25 -0400 Received: from foss.arm.com ([217.140.110.172]:34688 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbfHHPIZ (ORCPT ); Thu, 8 Aug 2019 11:08:25 -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 0D5121596; Thu, 8 Aug 2019 08:08:24 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 75D053F706; Thu, 8 Aug 2019 08:08:21 -0700 (PDT) References: <20190802090853.4810-1-patrick.bellasi@arm.com> <20190802090853.4810-3-patrick.bellasi@arm.com> <20190806161153.GA19991@blackbody.suse.cz> User-agent: mu4e 1.3.3; emacs 26.2 From: Patrick Bellasi To: Michal =?utf-8?Q?Koutn=C3=BD?= Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-api@vger.kernel.org, cgroups@vger.kernel.org, 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: Re: [PATCH v13 2/6] sched/core: uclamp: Propagate parent clamps In-reply-to: <20190806161153.GA19991@blackbody.suse.cz> Date: Thu, 08 Aug 2019 16:08:10 +0100 Message-ID: <87h86r4rvp.fsf@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 06, 2019 at 17:11:53 +0100, Michal Koutný wrote... > On Fri, Aug 02, 2019 at 10:08:49AM +0100, Patrick Bellasi wrote: >> @@ -7095,6 +7149,7 @@ static ssize_t cpu_uclamp_write(struct kernfs_open_file *of, char *buf, >> if (req.ret) >> return req.ret; >> >> + mutex_lock(&uclamp_mutex); >> rcu_read_lock(); >> >> tg = css_tg(of_css(of)); >> @@ -7107,7 +7162,11 @@ static ssize_t cpu_uclamp_write(struct kernfs_open_file *of, char *buf, >> */ >> tg->uclamp_pct[clamp_id] = req.percent; >> >> + /* Update effective clamps to track the most restrictive value */ >> + cpu_util_update_eff(of_css(of)); >> + >> rcu_read_unlock(); >> + mutex_unlock(&uclamp_mutex); > Following my remarks to "[PATCH v13 1/6] sched/core: uclamp: Extend > CPU's cgroup", I wonder if the rcu_read_lock() couldn't be moved right > before cpu_util_update_eff(). And by extension rcu_read_(un)lock could > be hidden into cpu_util_update_eff() closer to its actual need. Well, if I've got correctly your comment in the previous message, I would say that at this stage we don't need RCU looks at all. Reason being that cpu_util_update_eff() gets called only from cpu_uclamp_write() which is from an ongoing write operation on a cgroup attribute and thus granted to be available. We will eventually need to move the RCU look only down the stack when uclamp_update_active_tasks() gets called to update the RUNNABLE tasks on a RQ... or perhaps we don't need them since we already get the task_rq_lock() for each task we visit. Is that correct? Cheers, Patrick -- #include Patrick Bellasi