Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6957405ybh; Thu, 8 Aug 2019 08:11:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJYkGAYSBtRbiFuqkbt84OLoJoLyHO4dbTSCl7yHPHZQmk85RoI3A5tRPih3wGSVyNnNPT X-Received: by 2002:a65:5382:: with SMTP id x2mr7734043pgq.422.1565277091921; Thu, 08 Aug 2019 08:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565277091; cv=none; d=google.com; s=arc-20160816; b=NvJx83dVtGeZBoNQ2sPHgkfPZ+UBegxMiC5su9RYO568/SuYv8UafqUC2KUC49qFVK IbKutHiWOkbhSEwgqajsGnmkaQHTpMV065tFotpiCi/rpZ904AeoF/yGQE1K4xU9ebMx pmNtQunt4voBtMCBC96gHPTOu1hzKJWEhJn0AjXkwsNgplhV9tskjoRJ0c5UL4R6fdkP Jv1StlGF+mnipIk/jrIdtjoaxDD/B+zBVuAKAXmiXcafiYqU2MjFcmmhqqXYu/CU5811 NiPcSUvamNmnfAGw/Eq6EUnYsjl0P00BQ9h1okekBTzifiTumwltwYfy3tEMl0gVl7Dk GRtQ== 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 :date:in-reply-to:message-id:subject:cc:to:from:user-agent :references; bh=9GYNrfuJvuynFo6YQtaqTOrwva5dVdNCh/Zdr8MRda0=; b=DeXINS9isSDdBxNQKCn1qhTV77D9tldEXqBa5d5NuYg4FCDTEA/qD725oTx3W9tDoM yiPaaXRuXT9YAFHnKfb87G3Ba9dkTL6YHCAx3AWAhk0k+PECv8FuBril6fN0+2RjO8wl fvA33GfnhQPyvAkSRJjDJsWt1o1F+16XfuPgm1ZSNLjNlkJhunXYPNaJuYA4xgoJniqP J+K60NIe69fyZVatCWLt/oMLyvSP45RZQvQDQrmsXxrZlVXZukuVkUnXdFh/dzhZbz3W KLuT2LoKfJ3bhW66eVFdPL/8WegqyR9lpQBbH0u1+exh1rA1d1DEo+JDhSFmfkS2Q08p ziGQ== 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 h15si4884778plr.87.2019.08.08.08.11.16; Thu, 08 Aug 2019 08:11:31 -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 S1732867AbfHHPK1 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 8 Aug 2019 11:10:27 -0400 Received: from foss.arm.com ([217.140.110.172]:34730 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732404AbfHHPK1 (ORCPT ); Thu, 8 Aug 2019 11:10:27 -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 0D8CC1596; Thu, 8 Aug 2019 08:10:26 -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 732293F706; Thu, 8 Aug 2019 08:10:23 -0700 (PDT) References: <20190802090853.4810-1-patrick.bellasi@arm.com> <20190802090853.4810-2-patrick.bellasi@arm.com> <20190806161133.GA18532@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 1/6] sched/core: uclamp: Extend CPU's cgroup controller Message-ID: <87imr74sfh.fsf@arm.com> In-reply-to: <20190806161133.GA18532@blackbody.suse.cz> Date: Thu, 08 Aug 2019 16:10:21 +0100 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:34 +0100, Michal Koutný wrote... > On Fri, Aug 02, 2019 at 10:08:48AM +0100, Patrick Bellasi wrote: >> +static ssize_t cpu_uclamp_write(struct kernfs_open_file *of, char *buf, >> + size_t nbytes, loff_t off, >> + enum uclamp_id clamp_id) >> +{ >> + struct uclamp_request req; >> + struct task_group *tg; >> + >> + req = capacity_from_percent(buf); >> + if (req.ret) >> + return req.ret; >> + >> + rcu_read_lock(); > This should be the uclamp_mutex. > > (The compound results of the series is correct as the lock is introduced > in "sched/core: uclamp: Propagate parent clamps". > This is just for the happiness of cherry-pickers/bisectors.) Right, will move the uclamp_mutex introduction in this patch instead of in the following one. >> +static inline void cpu_uclamp_print(struct seq_file *sf, >> + enum uclamp_id clamp_id) >> +{ >> [...] >> + rcu_read_lock(); >> + tg = css_tg(seq_css(sf)); >> + util_clamp = tg->uclamp_req[clamp_id].value; >> + rcu_read_unlock(); > Why is the rcu_read_lock() needed here? (I'm considering the comment in > of_css() that should apply here (and it seems that similar uses in other > seq_file handlers also skip this).) So, looks like that since we are in the context of a file operation, all the cgroup's attribute read/write functions are implicitly save. IOW, we don't need an RCU lock since the TG data structures are granted to be always available till the end of the read/write operation. That seems to make sense... I'm wondering if keeping the RCU look is still a precaution for possible future code/assumption changes or just an unnecessary overhead? >> @@ -7369,6 +7506,20 @@ static struct cftype cpu_legacy_files[] = { >> [...] >> + .name = "uclamp.min", >> [...] >> + .name = "uclamp.max", > I don't see technical reasons why uclamp couldn't work on legacy > hierarchy and Tejun acked the series, despite that I'll ask -- should > the new attributes be exposed in v1 controller hierarchy (taking into > account the legacy API is sort of frozen and potential maintenance needs > spanning both hierarchies)? Not sure to get what you mean here: I'm currently exposing uclamp to both v1 and v2 hierarchies. Best, Patrick -- #include Patrick Bellasi