lkml.org 
[lkml]   [2019]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller
On Tue, Sep 3, 2019 at 4:53 AM Michal Koutný <mkoutny@suse.com> wrote:
>
> On Mon, Sep 02, 2019 at 04:02:57PM -0700, Suren Baghdasaryan <surenb@google.com> wrote:
> > > +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();
> > > +
> > > + if (util_clamp == SCHED_CAPACITY_SCALE) {
> > > + seq_puts(sf, "max\n");
> > > + return;
> > > + }
> > > +
> > > + percent = 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

\
 
 \ /
  Last update: 2019-09-03 16:23    [W:0.071 / U:3.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site