Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2056902ybe; Tue, 3 Sep 2019 07:23:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYOuyF+VQqjvukuhihzeaP/jwSD1onb3CH+zFghQm0b9sXtJthSQlJlmePk7B77bz52LTF X-Received: by 2002:a17:902:8d8d:: with SMTP id v13mr35416472plo.137.1567520620634; Tue, 03 Sep 2019 07:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567520620; cv=none; d=google.com; s=arc-20160816; b=dGpzlG3d/wu7Z10xGJBuOncGDCf2t4Jl/kDfb1cYVmoliaaTMn2gjjoubuSgG9PIGK ZbzSdxCEvmo+G0Epmr2uJy4tbUBc3R4khHgObIHaHDUdfy/udjzCF3XtAFMmqJlgGAUT ocIbptAotxCGeIiKlOYXPh6LOws7d3hdgaH7BHC+W3xGDaZhKUnS1alCBy4Bh+F53QDq ibqviU4MQjaHAtx1+EXTMUAQPHF70c/x1J4SMh1gMIWpOYURYUIIgtduPG6BD3kGYkps 8Y7LxeQG0AJVLUujuBrw2bN5xkgWvXYiLw7p4ZSGfnMobKa1tcyjGMZW8ZartU0I4c+F E4eA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zXvrHc8bIlM8VodivjNDsnx6+oAEFk8HI08Pi/PdZy0=; b=OQZaZuk/T6KQ/KYg9PMwr06TGUvGLtuWo1Y9/tJ1MzevJghJzfIzxa5VJ9caPva+F4 OxjmnQe4nc8IxYBxukbQwE81vHol3ooDy9Gl9RqcqlPFBc1O8T8RJDgEzoSnjbSyJ49u TRUKb0HbiFMOjpfGDBKsIpFA+t1KUMGisYcpo6eoOmYbpwEI0CYTOnIb0/3cbusCPTiX f220oiLoY5FRH4fqseWSN6QdJkIh+CCoO1U80BXoMG8pPWE5SVk8IsMVhHKFPYiB7yUq XXduamivg+V2OMEom/JNn+q0KYOvN0Zmucb74At6Pe/SkRmSA0MMNzoHOX1bQWcZZhYG UeEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=arZrudyL; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f30si7757509pjd.59.2019.09.03.07.23.24; Tue, 03 Sep 2019 07:23:40 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=arZrudyL; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729562AbfICOWO (ORCPT + 99 others); Tue, 3 Sep 2019 10:22:14 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:42856 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729113AbfICOWL (ORCPT ); Tue, 3 Sep 2019 10:22:11 -0400 Received: by mail-qk1-f195.google.com with SMTP id f13so16039109qkm.9 for ; Tue, 03 Sep 2019 07:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zXvrHc8bIlM8VodivjNDsnx6+oAEFk8HI08Pi/PdZy0=; b=arZrudyLT8vTBXeGc+RzCc8cTYEs3iyuTYalOAK8Glv1IOK+eWWBNQWyvS8kFPmvs8 cXIvmXi+hJkM1FOJpx5IPOjfYvPRIzhid3fb2nB/JrVWSTaqecT2VZSSzQiT3GLBEhVD smanZ/a5pgEUewoLHRsTzIMv9ved1r7kbjWXhXrjDyLyY7rPLZf0ySFrYu7mKpvQJxkF 6zkSA2MEAIopfNY5Ll0n+vlI8Z1hVWLGrtAY/KyJTTp+EipIkSMRL9vg7B0zT/2F6vW+ GLuEGCAkw1KhNkAUKZ5Qs8nmOqIqiZ993sMb4VYDVKWNLkoIjdzO2woNnmAnCXfVizng kRPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zXvrHc8bIlM8VodivjNDsnx6+oAEFk8HI08Pi/PdZy0=; b=Wxc5T0dy+G30uE2yM2uUj9eMscNRZ7EnVc/sgyKC8jjVCnDWOHPgBpzCOl9oVgYsTj jGpKIsdKuzam9fiG6vm/b6NiDji2AMMPc6N/UVlWO6sNoxd/WVDX0nJfYw5S5mcgx5FX gJSsQmRIvmTcFVAHqmdmhBhSLxu+m/M1x3kmMOg/dHCylVvNtEss2OMllg1N6oBHwkbj QLZQBMAGKmjyg+YKcGXEP2FFNabcN6mdHDRele9wWOq5kE7azneHeYICz7E0zQ8boohY UkdlhNkE0Z0mRsEGHswitXDCWxUKt7KI4A9BpOwA+CMOnJpUVInPuGFxD9vlxXzJPbNJ VHDg== X-Gm-Message-State: APjAAAXupm6sDzLrDzTm8y1UBOEY8W/B3P2PC2IQuglvQNzEsebApyVn AHnmmF0eOE/YvH/aU+frPs8AKonulBCBvblF+6dnhw== X-Received: by 2002:a05:620a:1367:: with SMTP id d7mr12839832qkl.20.1567520530372; Tue, 03 Sep 2019 07:22:10 -0700 (PDT) MIME-Version: 1.0 References: <20190822132811.31294-1-patrick.bellasi@arm.com> <20190822132811.31294-2-patrick.bellasi@arm.com> <20190903085248.GB8756@blackbody.suse.cz> In-Reply-To: <20190903085248.GB8756@blackbody.suse.cz> From: Joel Fernandes Date: Tue, 3 Sep 2019 10:21:59 -0400 Message-ID: Subject: Re: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Suren Baghdasaryan , Patrick Bellasi , Alessio Balsini , Dietmar Eggemann , Morten Rasmussen , Quentin Perret , Paul Turner , Steve Muckle , Todd Kjos , Peter Zijlstra , "Rafael J . Wysocki" , Tejun Heo , Vincent Guittot , Viresh Kumar , Juri Lelli , Ingo Molnar , cgroups mailinglist , linux-api@vger.kernel.org, LKML , Linux PM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 3, 2019 at 4:53 AM Michal Koutn=C3=BD wrote: > > On Mon, Sep 02, 2019 at 04:02:57PM -0700, Suren Baghdasaryan wrote: > > > +static inline void cpu_uclamp_print(struct seq_file *sf, > > > + enum uclamp_id clamp_id) > > > [...] > > > + rcu_read_lock(); > > > + tg =3D css_tg(seq_css(sf)); > > > + util_clamp =3D tg->uclamp_req[clamp_id].value; > > > + rcu_read_unlock(); > > > + > > > + if (util_clamp =3D=3D SCHED_CAPACITY_SCALE) { > > > + seq_puts(sf, "max\n"); > > > + return; > > > + } > > > + > > > + percent =3D tg->uclamp_pct[clamp_id]; > > > > You are taking RCU lock when accessing tg->uclamp_req but not when > > accessing tg->uclamp_pct. > Good point. > > > Is that intentional? Can tg be destroyed under you? > Actually, the rcu_read{,un}lock should be unnecessary in the context of > the kernfs file op handler -- the tg/css won't go away as long as its > kernfs file is being worked with. > Also, add to that the fact that there is no rcu_dereference() call to access any of the pointers in the reader or any of its callers. And, I don't see any "wait for completion" type of pattern here so that rcu_read_{lock, unlock}() pair does seem useless. thanks, - Joel