Re: [RFC PATCH v3 2/3] blk-cgroup: store blkcg in bio instead of blkg
Tao Cui <[email protected]>
| Newsgroups | org.kernel.vger.linux-fsdevel,dev.linux.lists.dm-devel,dev.linux.lists.gfs2,dev.linux.lists.nvdimm,dev.linux.lists.virtualization,org.kernel.vger.cgroups,org.kernel.vger.linux-bcache,org.kernel.vger.linux-block,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-raid,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
在 2026/8/18 15:06, Yu Kuai 写道: > A bio currently stores and pins a queue-local blkg. This forces bio > association and remap paths to look up or create a blkg even when no > blkcg policy will use the bio, and ties the stored state to the current > block device. > > Store and reference the queue-independent blkcg in the bio instead. Add > helpers that lazily look up or create the queue-local blkg when a policy > needs it, and pin the result until the bio changes devices or releases > its cgroup state. > > If blkg creation fails while walking down the hierarchy, use the closest > available ancestor and update the bio's blkcg association before recording > the blkg reference. This keeps later CSS ID hash lookups matched with the > pinned blkg. > > Keep lookup-only users from creating missing blkgs. A pinned blkg remains > in the queue hash until the bio drops its reference, so allow the bio to > recover it from the hash after the blkg starts dying. Rename the bio > association helpers to describe the blkcg state they now store. Reviewed-by: Tao Cui <[email protected]>