Commit 494eaf4
sched_ext: Replace naked scx_root dereferences in kobject callbacks
scx_attr_ops_show() and scx_uevent() access scx_root->ops.name directly.
This is problematic for two reasons:
1. The file-level comment explicitly identifies naked scx_root
dereferences as a temporary measure that needs to be replaced
with proper per-instance access.
2. scx_attr_events_show(), the neighboring sysfs show function in
the same group, already uses the correct pattern:
struct scx_sched *sch = container_of(kobj, struct scx_sched, kobj);
Having inconsistent access patterns in the same sysfs/uevent
group is error-prone.
The kobject embedded in struct scx_sched is initialized as:
kobject_init_and_add(&sch->kobj, &scx_ktype, NULL, "root");
so container_of(kobj, struct scx_sched, kobj) correctly retrieves
the owning scx_sched instance in both callbacks.
Replace the naked scx_root dereferences with container_of()-based
access, consistent with scx_attr_events_show() and in preparation
for proper multi-instance scx_sched support.
Signed-off-by: zhidao su <suzhidao@xiaomi.com>
Signed-off-by: Tejun Heo <tj@kernel.org>1 parent 9adfcef commit 494eaf4
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3712 | 3712 | | |
3713 | 3713 | | |
3714 | 3714 | | |
3715 | | - | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
3716 | 3718 | | |
3717 | 3719 | | |
3718 | 3720 | | |
| |||
3756 | 3758 | | |
3757 | 3759 | | |
3758 | 3760 | | |
3759 | | - | |
| 3761 | + | |
| 3762 | + | |
| 3763 | + | |
3760 | 3764 | | |
3761 | 3765 | | |
3762 | 3766 | | |
| |||
0 commit comments