From: Jing-Ting Wu <jing-ting.wu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
To: "Tejun Heo" <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>
Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
Matthias Brugger
<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
wsd_upstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
lixiong.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
wenju.xu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
jonathan.jmchen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org
Subject: Re: [Bug] race condition at rebind_subsystems()
Date: Mon, 18 Jul 2022 15:44:21 +0800 [thread overview]
Message-ID: <d8f0bc5e2fb6ed259f9334c83279b4c011283c41.camel@mediatek.com> (raw)
In-Reply-To: <YtGaP+e35DZYSQf0-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
On Fri, 2022-07-15 at 06:47 -1000, Tejun Heo wrote:
> (resending, I messed up the message header, sorry)
>
> Hello,
>
> On Fri, Jul 15, 2022 at 01:59:38PM +0200, Michal Koutný wrote:
> > The css->rstat_css_node should not be modified if there are
> > possible RCU
> > readers elsewhere.
> > One way to fix this would be to insert synchronize_rcu() after
> > list_del_rcu() and before list_add_rcu().
> > (A further alternative (I've heard about) would be to utilize
> > 'nulls'
> > RCU lists [1] to make the move between lists detectable.)
> >
> > But as I'm looking at it from distance, it may be simpler and
> > sufficient
> > to just take cgroup_rstat_lock around the list migration (the
> > nesting
> > under cgroup_mutex that's held with rebind_subsystems() is fine).
>
> synchronize_rcu() prolly is the better fit here given how that
> list_node's
> usage, but yeah, great find.
>
> Thanks.
>
Hi Michal and Tejun,
Thanks for your suggestion.
Accroding your description, is the following patch corrent?
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1813,6 +1813,7 @@
if (ss->css_rstat_flush) {
list_del_rcu(&css->rstat_css_node);
+ synchronize_rcu();
list_add_rcu(&css->rstat_css_node,
&dcgrp->rstat_css_list);
}
If the patch is correct, we will add this patch to our stability test.
And we will continue to observe whether the problem is solved.
Thank you.
Best regards,
Jing-Ting Wu
next prev parent reply other threads:[~2022-07-18 7:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 10:52 [Bug] race condition at rebind_subsystems() Jing-Ting Wu
2022-07-15 11:59 ` Michal Koutný
[not found] ` <20220715115938.GA8646-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-07-15 16:47 ` Tejun Heo
[not found] ` <YtGaP+e35DZYSQf0-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-07-18 7:44 ` Jing-Ting Wu [this message]
2022-07-19 13:35 ` Michal Koutný
[not found] ` <20220719133512.GD897-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-07-21 6:46 ` Jing-Ting Wu
[not found] ` <98d738ec5d7d32441f6e62278fff32201fd948de.camel-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2022-08-07 6:58 ` Jing-Ting Wu
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=d8f0bc5e2fb6ed259f9334c83279b4c011283c41.camel@mediatek.com \
--to=jing-ting.wu-nus5lvnupcjwk0htik3j/w@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=jonathan.jmchen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=lixiong.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
--cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=mkoutny-IBi9RG/b67k@public.gmane.org \
--cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=wenju.xu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=wsd_upstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
/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