mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
cgroup: use cgrp->kn->id as the cgroup ID
cgroup ID is currently allocated using a dedicated per-hierarchy idr and used internally and exposed through tracepoints and bpf. This is confusing because there are tracepoints and other interfaces which use the cgroupfs ino as IDs. The preceding changes made kn->id exposed as ino as 64bit ino on supported archs or ino+gen (low 32bits as ino, high gen). There's no reason for cgroup to use different IDs. The kernfs IDs are unique and userland can easily discover them and map them back to paths using standard file operations. This patch replaces cgroup IDs with kernfs IDs. * cgroup_id() is added and all cgroup ID users are converted to use it. * kernfs_node creation is moved to earlier during cgroup init so that cgroup_id() is available during init. * While at it, s/cgroup/cgrp/ in psi helpers for consistency. * Fallback ID value is changed to 1 to be consistent with root cgroup ID. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -171,7 +171,7 @@ void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg,
|
||||
blkcg = NULL;
|
||||
#ifdef CONFIG_BLK_CGROUP
|
||||
trace_note(bt, 0, BLK_TN_MESSAGE, buf, n,
|
||||
blkcg ? cgroup_get_kernfs_id(blkcg->css.cgroup) : 0);
|
||||
blkcg ? cgroup_id(blkcg->css.cgroup) : 1);
|
||||
#else
|
||||
trace_note(bt, 0, BLK_TN_MESSAGE, buf, n, 0);
|
||||
#endif
|
||||
@@ -759,7 +759,7 @@ static u64 blk_trace_bio_get_cgid(struct request_queue *q, struct bio *bio)
|
||||
|
||||
if (!bio->bi_blkg)
|
||||
return 0;
|
||||
return cgroup_get_kernfs_id(bio_blkcg(bio)->css.cgroup);
|
||||
return cgroup_id(bio_blkcg(bio)->css.cgroup);
|
||||
}
|
||||
#else
|
||||
u64 blk_trace_bio_get_cgid(struct request_queue *q, struct bio *bio)
|
||||
|
||||
Reference in New Issue
Block a user