[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAcV7GmTJGbC1R_s@gourry-fedora-PF4VCD3F>
Date: Tue, 22 Apr 2025 00:07:08 -0400
From: Gregory Price <gourry@...rry.net>
To: Waiman Long <llong@...hat.com>
Cc: linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...a.com,
hannes@...xchg.org, mhocko@...nel.org, roman.gushchin@...ux.dev,
shakeel.butt@...ux.dev, muchun.song@...ux.dev, tj@...nel.org,
mkoutny@...e.com, akpm@...ux-foundation.org
Subject: Re: [PATCH v4 2/2] vmscan,cgroup: apply mems_effective to reclaim
On Mon, Apr 21, 2025 at 10:02:22PM -0400, Waiman Long wrote:
> > +bool cpuset_node_allowed(struct cgroup *cgroup, int nid)
> > +{
> > + struct cgroup_subsys_state *css;
> > + struct cpuset *cs;
> > + bool allowed;
> > +
> > + /*
> > + * In v1, mem_cgroup and cpuset are unlikely in the same hierarchy
> > + * and mems_allowed is likely to be empty even if we could get to it,
> > + * so return true to avoid taking a global lock on the empty check.
> > + */
> > + if (!cpuset_v2())
> > + return true;
> > +
> > + css = cgroup_get_e_css(cgroup, &cpuset_cgrp_subsys);
> > + if (!css)
> > + return true;
> > +
> > + cs = container_of(css, struct cpuset, css);
> > + rcu_read_lock();
>
> Sorry, I missed the fact that cgroup_get_e_css() will take a reference to
> the css and so it won't go away. In that case, rcu_read_lock() isn't really
> needed. However, I do want a comment to say that accessing effective_mems
> should normally requrie taking either a cpuset_mutex or callback_lock, but
> is skipped in this case to avoid taking a global lock in the reclaim path at
> the expense that the result may be inaccurate in some rare cases.
>
I'll add a differential patch here.
~Gregory
Powered by blists - more mailing lists