On Wed, Aug 28, 2024 at 11:32:24AM +0800, Haifeng Xu wrote: > + } else if (buffer_meta(bh)) { > + struct folio *folio; > + struct cgroup_subsys_state *memcg_css, *blkcg_css; > + > + folio = page_folio(bh->b_page); > + memcg_css = mem_cgroup_css_from_folio(folio); > + if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && > + cgroup_subsys_on_dfl(io_cgrp_subsys)) { > + blkcg_css = cgroup_e_css(memcg_css->cgroup, &io_cgrp_subsys); > + bio_associate_blkg_from_css(bio, blkcg_css); > + } I'll leave it to people more familiar with cgroups to decide if this is the right thing to do, but if it is the code here should go into a helper so that other metadata bio submitters can reuse it. That helper also should have a good comment explaining it.