On Thu, Feb 01, 2024 at 01:02:04PM -0800, "T.J. Mercier" <tjmercier@xxxxxxxxxx> wrote: > It does blow up, but not how I was expecting. There's a null pointer > dereference inside find_css_set when trying to get a css pointer for > the memory controller, I think because the allocation in > cgroup_init_subsys is skipped: Thanks for trying! I suspected it won't be easy. At the same time I suspected there must be a hook for your purpose -- after looking at cpuset, I was reminded of cgroup_subsys.bind callback. What about triggering periodic flush in that callback? (memcg doesn't implement it yet but cgroup_init() takes it into account.) It would take any dwork activation out of mem_cgroup_css_online() and it seems cleaner. (Ideally, the flush could be disabled again when memcg root is unmounted again. (That's impossible and practically unused but that's why consider callback approach cleaner. Of course, your original guard serves the purpose too.)) Regards, Michal