On 5/24/23 23:04, Waiman Long wrote:
Hi Waiman,
I don't have context about blkcg, but isn't this exactly what
cgroup_rstat_lock does? Is it too expensive to just call
cgroup_rstat_flush () here?
I have thought about that too. However, in my test, just calling
cgroup_rstat_flush() in blkcg_destroy_blkgs() did not prevent dying
blkcgs from increasing meaning that there are still some extra
references blocking its removal. I haven't figured out exactly why
that is the case. There may still be some races that we have not fully
understood yet. On the other hand, Ming's patch is verified to not do
that since it does not take extra blkg references. So I am leaning on
his patch now. I just have to make sure that there is no concurrent
rstat update.
It is also true that calling cgroup_rstat_flush() is much more
expensive, especially at the blkg level where there can be many blkgs to
be destroyed when a blkcg is destroyed.
Cheers,
Longman