hulk inclusion category: cleanup bugzilla: https://atomgit.com/openeuler/kernel/issues/8423 -------------------------------- This commit replaces a hardcoded magic number used for the maximum length of scheduler class name strings with the named constant SCHED_CLASS_MAX_LENGTH. No functional change is introduced, this is a pure cleanup for better code hygiene. Signed-off-by: Liu Kai <liukai284@huawei.com> --- include/linux/xsched.h | 3 +-- kernel/xsched/cgroup.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/xsched.h b/include/linux/xsched.h index a0ed200409f6..b160d93ba337 100644 --- a/include/linux/xsched.h +++ b/include/linux/xsched.h @@ -39,6 +39,7 @@ #define XSCHED_CFS_WEIGHT_DFLT 1024 #define XSCHED_CFS_QUOTA_PERIOD_MS (100 * NSEC_PER_MSEC) #define XSCHED_CFG_SHARE_DFLT 1024 +#define SCHED_CLASS_MAX_LENGTH 4 /* * A default kick slice for RT class XSEs. @@ -491,8 +492,6 @@ void xsched_quota_refill(struct work_struct *work); #define XCUCG_SET_FILE_RETRY_COUNT 100 #define XCUCG_SET_FILE_DELAY_MS 10 -#define SCHED_CLASS_MAX_LENGTH 4 - #endif static inline u64 xs_calc_delta(u64 delta_exec, u32 base_weight, u32 weight) diff --git a/kernel/xsched/cgroup.c b/kernel/xsched/cgroup.c index 3060ad16f3e8..24d799e9301f 100644 --- a/kernel/xsched/cgroup.c +++ b/kernel/xsched/cgroup.c @@ -34,7 +34,7 @@ static LIST_HEAD(xcg_attach_list); static DEFINE_MUTEX(xcg_mutex); static DEFINE_MUTEX(xcu_file_show_mutex); -static const char xcu_sched_name[XSCHED_TYPE_NUM][4] = { +static const char xcu_sched_name[XSCHED_TYPE_NUM][SCHED_CLASS_MAX_LENGTH] = { [XSCHED_TYPE_RT] = "rt", [XSCHED_TYPE_CFS] = "cfs" }; -- 2.34.1