Linux cgroups development
 help / color / mirror / Atom feed
From: Waiman Long <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>,
	"Ming Lei" <ming.lei-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Yosry Ahmed <yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Linux-MM <linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Roman Gushchin
	<roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>,
	Muchun Song <muchun.song-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>,
	Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
	linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] blk-cgroup: Flush stats before releasing blkcg_gq
Date: Thu, 25 May 2023 11:25:05 -0400	[thread overview]
Message-ID: <8f56f60f-8dd3-d798-3d81-6ccbb185465d@redhat.com> (raw)
In-Reply-To: <3ej42djuuzwx36yf2yeo5ggyrvogeaguos5jtve2bvuaejnwff@fak3yjwe2fbi>


On 5/25/23 10:11, Michal Koutný wrote:
> On Wed, May 24, 2023 at 10:37:10AM +0800, Ming Lei <ming.lei-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>>> I am not at all familiar with blkcg, but does calling
>>> cgroup_rstat_flush() in offline_css() fix the problem?
>> Except for offline, this list needs to be flushed after the associated disk
>> is deleted.
> Why the second flush trigger?
> a) To break another ref-dependency cycle (like on the blkcg side)?
> b) To avoid stale data upon device removal?
>
> (Because b) should be unnecessary, a future reader would flush when
> needed.)

Since the percpu blkg_iostat_set's that are linked in the lockless list 
will be freed if the corresponding blkcg_gq is freed, we need to flush 
the lockless list to avoid potential use-after-free in a future 
cgroup_rstat_flush*() call.

Cheers,
Longman


  reply	other threads:[~2023-05-25 15:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  1:19 [PATCH] blk-cgroup: Flush stats before releasing blkcg_gq Ming Lei
     [not found] ` <20230524011935.719659-1-ming.lei-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2023-05-24  2:06   ` Yosry Ahmed
     [not found]     ` <CAJD7tkZkbro4H-QC=RJx_dfCdGQ5c=4NJhbFrcEmQSidaaMOmg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-05-24  2:37       ` Ming Lei
     [not found]         ` <ZG14VnHl20lt9jLc-j9QsSs0H/W6P5pAslXv9rxcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2023-05-24  2:43           ` Yosry Ahmed
2023-05-24  4:10         ` Waiman Long
2023-05-24  4:21           ` Ming Lei
2023-05-25 14:11         ` Michal Koutný
2023-05-25 15:25           ` Waiman Long [this message]
     [not found]             ` <8f56f60f-8dd3-d798-3d81-6ccbb185465d-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2023-05-26 21:11               ` Michal Koutný
2023-05-24  4:04       ` Waiman Long
     [not found]         ` <11e81fc8-24db-54db-a518-b9bb67d0b504-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2023-05-24  4:13           ` Yosry Ahmed
     [not found] <20230525043518.831721-1-ming.lei@redhat.com>
2023-05-25 16:01 ` Waiman Long
2023-05-25 16:06   ` Waiman Long
2023-05-26  0:34     ` Ming Lei

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=8f56f60f-8dd3-d798-3d81-6ccbb185465d@redhat.com \
    --to=longman-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ming.lei-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=mkoutny-IBi9RG/b67k@public.gmane.org \
    --cc=muchun.song-fxUVXftIFDnyG1zEObXtfA@public.gmane.org \
    --cc=roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org \
    --cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@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