[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9cf00007-f068-4ced-8977-f39a792eef6a@gmail.com>
Date: Tue, 10 Jun 2025 22:23:51 -0700
From: JP Kobryn <inwardvessel@...il.com>
To: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: Johannes Weiner <hannes@...xchg.org>,
Andrew Morton <akpm@...ux-foundation.org>, Tejun Heo <tj@...nel.org>,
Michal Hocko <mhocko@...nel.org>, Roman Gushchin <roman.gushchin@...ux.dev>,
Muchun Song <muchun.song@...ux.dev>, Vlastimil Babka <vbabka@...e.cz>,
Alexei Starovoitov <ast@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Michal Koutný <mkoutny@...e.com>,
Harry Yoo <harry.yoo@...cle.com>, Yosry Ahmed <yosry.ahmed@...ux.dev>,
bpf@...r.kernel.org, linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, Meta kernel team <kernel-team@...a.com>
Subject: Re: [PATCH 2/3] cgroup: make css_rstat_updated nmi safe
On 6/9/25 3:56 PM, Shakeel Butt wrote:
[..]
> diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
> index a5608ae2be27..4fabd7973067 100644
> --- a/kernel/cgroup/rstat.c
> +++ b/kernel/cgroup/rstat.c
> @@ -138,13 +138,15 @@ void _css_rstat_cpu_unlock(struct cgroup_subsys_state *css, int cpu,
> * @css: target cgroup subsystem state
> * @cpu: cpu on which rstat_cpu was updated
> *
> - * @css's rstat_cpu on @cpu was updated. Put it on the parent's matching
> - * rstat_cpu->updated_children list. See the comment on top of
> - * css_rstat_cpu definition for details.
> + * Atomically inserts the css in the ss's llist for the given cpu. This is nmi
> + * safe. The ss's llist will be processed at the flush time to create the update
> + * tree.
> */
> __bpf_kfunc void css_rstat_updated(struct cgroup_subsys_state *css, int cpu)
> {
> - unsigned long flags;
> + struct llist_head *lhead = ss_lhead_cpu(css->ss, cpu);
> + struct css_rstat_cpu *rstatc = css_rstat_cpu(css, cpu);
> + struct llist_node *self;
>
> /*
> - flags = _css_rstat_cpu_lock(css, cpu, true);
> + llist_add(&rstatc->lnode, lhead);
> +}
[..]
> +
> +static void css_process_update_tree(struct cgroup_subsys *ss, int cpu)
> +{
> + struct llist_head *lhead = ss_lhead_cpu(ss, cpu);
> + struct llist_node *lnode;
> +
> + while ((lnode = llist_del_first_init(lhead))) {
> + struct css_rstat_cpu *rstatc;
>
> - _css_rstat_cpu_unlock(css, cpu, flags, true);
> + rstatc = container_of(lnode, struct css_rstat_cpu, lnode);
> + __css_process_update_tree(rstatc->owner, cpu);
> + }
> }
>
> /**
> @@ -300,6 +331,8 @@ static struct cgroup_subsys_state *css_rstat_updated_list(
>
> flags = _css_rstat_cpu_lock(root, cpu, false);
The subsystem per-cpu locks were used to synchronize updater and flusher
on a given cpu. Since you no longer use them on the updater side, it
seems these locks can be removed altogether.
Powered by blists - more mailing lists