From: JP Kobryn <inwardvessel@gmail.com>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: "Johannes Weiner" <hannes@cmpxchg.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Tejun Heo" <tj@kernel.org>, "Michal Hocko" <mhocko@kernel.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Muchun Song" <muchun.song@linux.dev>,
"Vlastimil Babka" <vbabka@suse.cz>,
"Alexei Starovoitov" <ast@kernel.org>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Michal Koutný" <mkoutny@suse.com>,
"Harry Yoo" <harry.yoo@oracle.com>,
"Yosry Ahmed" <yosry.ahmed@linux.dev>,
bpf@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Meta kernel team" <kernel-team@meta.com>
Subject: Re: [PATCH 2/3] cgroup: make css_rstat_updated nmi safe
Date: Tue, 10 Jun 2025 22:23:51 -0700 [thread overview]
Message-ID: <9cf00007-f068-4ced-8977-f39a792eef6a@gmail.com> (raw)
In-Reply-To: <20250609225611.3967338-3-shakeel.butt@linux.dev>
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.
next prev parent reply other threads:[~2025-06-11 5:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-09 22:56 [PATCH 0/3] cgroup: nmi safe css_rstat_updated Shakeel Butt
2025-06-09 22:56 ` [PATCH 1/3] cgroup: support to enable nmi-safe css_rstat_updated Shakeel Butt
2025-06-09 22:56 ` [PATCH 2/3] cgroup: make css_rstat_updated nmi safe Shakeel Butt
2025-06-10 21:26 ` Tejun Heo
2025-06-10 22:31 ` Shakeel Butt
2025-06-10 22:39 ` Tejun Heo
2025-06-10 23:28 ` Shakeel Butt
2025-06-10 23:33 ` Tejun Heo
2025-06-11 5:23 ` JP Kobryn [this message]
2025-06-11 13:56 ` Shakeel Butt
2025-06-09 22:56 ` [PATCH 3/3] memcg: cgroup: call memcg_rstat_updated irrespective of in_nmi() Shakeel Butt
2025-06-09 23:44 ` [PATCH 0/3] cgroup: nmi safe css_rstat_updated Andrew Morton
2025-06-09 23:51 ` Shakeel Butt
2025-06-10 10:53 ` Michal Koutný
2025-06-10 16:24 ` Shakeel Butt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9cf00007-f068-4ced-8977-f39a792eef6a@gmail.com \
--to=inwardvessel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
--cc=yosry.ahmed@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®