Offering: HULK hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IARWZ2
--------------------------------
Adding KABI_RESERVE for psi_stat_states results in redundant information being shown when running cat pressure.stat. Therefore, add PSI_STATE_LAST to maintain an unchanged KABI and eliminate the invalid information displayed in pressure.stat.
Fixes: cbd277b915b9 ("cgroup/psi: reserve kabi for future psi development") Signed-off-by: Chen Ridong chenridong@huawei.com --- include/linux/psi_types.h | 5 ++++- kernel/sched/psi.c | 14 +++++++------- 2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h index 1c5bca4e48ed..b224a89c293e 100644 --- a/include/linux/psi_types.h +++ b/include/linux/psi_types.h @@ -100,12 +100,15 @@ enum psi_stat_states { #ifdef CONFIG_QOS_SCHED PSI_CPU_QOS_FULL, #endif + /* reserve for KABI start */ + PSI_STATE_LAST, PSI_STATE_RESERVE1, PSI_STATE_RESERVE2, PSI_STATE_RESERVE3, PSI_STATE_RESERVE4, PSI_STATE_RESERVE5, - PSI_STATE_RESERVE6, + /* reserve for KABI end */ + NR_PSI_STAT_STATES, };
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index c66f64ab9f4e..9f68756a3baf 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -470,12 +470,12 @@ static void get_recent_stat_times(struct psi_group *group, int cpu, enum psi_aggregators aggregator, u64 *stat_delta, u64 nonidle) { struct psi_group_cpu *groupc = per_cpu_ptr(group->pcpu, cpu); - u32 times[NR_PSI_STAT_STATES] = {0}; + u32 times[PSI_STATE_LAST] = {0}; enum psi_stat_states s; u32 delta;
- memcpy(times, groupc->fine_grained_times, sizeof(groupc->fine_grained_times)); - for (s = 0; s < NR_PSI_STAT_STATES; s++) { + for (s = 0; s < PSI_STATE_LAST; s++) { + times[s] = groupc->fine_grained_times[s]; if (groupc->fine_grained_state_mask & (1 << s)) times[s] += groupc->fine_grained_times_delta; delta = times[s] - groupc->fine_grained_times_prev[aggregator][s]; @@ -522,7 +522,7 @@ static void collect_percpu_times(struct psi_group *group, u32 *pchanged_states) { #ifdef CONFIG_PSI_FINE_GRAINED - u64 stat_delta[NR_PSI_STAT_STATES] = { 0 }; + u64 stat_delta[PSI_STATE_LAST] = { 0 }; #endif u64 deltas[NR_PSI_STATES - 1] = { 0, }; unsigned long nonidle_total = 0; @@ -575,7 +575,7 @@ static void collect_percpu_times(struct psi_group *group, div_u64(deltas[s], max(nonidle_total, 1UL));
#ifdef CONFIG_PSI_FINE_GRAINED - for (s = 0; s < NR_PSI_STAT_STATES; s++) + for (s = 0; s < PSI_STATE_LAST; s++) group->fine_grained_total[aggregator][s] += div_u64(stat_delta[s], max(nonidle_total, 1UL)); #endif @@ -753,7 +753,7 @@ static u64 update_averages(struct psi_group *group, u64 now) calc_avgs(group->avg[s], missed_periods, sample, period); } #ifdef CONFIG_PSI_FINE_GRAINED - for (s = 0; s < NR_PSI_STAT_STATES; s++) { + for (s = 0; s < PSI_STATE_LAST; s++) { u32 stat_sample;
stat_sample = group->fine_grained_total[PSI_AVGS][s] - @@ -1935,7 +1935,7 @@ int psi_stat_show(struct seq_file *m, struct psi_group *group) group->avg_next_update = update_averages(group, now); mutex_unlock(&group->avgs_lock);
- for (i = 0; i < NR_PSI_STAT_STATES; i++) { + for (i = 0; i < PSI_STATE_LAST; i++) { unsigned long avg[3] = {0, }; int w; u64 total;
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,转换为PR失败! 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/X... 失败原因:补丁集缺失封面信息 建议解决方法:请提供补丁集并重新发送您的补丁集到邮件列表
FeedBack: The patch(es) which you have sent to kernel@openeuler.org has been converted to PR failed! Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/X... Failed Reason: the cover of the patches is missing Suggest Solution: please checkout and apply the patches' cover and send all again
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,转换为PR失败! 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/X... 失败原因:补丁集缺失封面信息 建议解决方法:请提供补丁集并重新发送您的补丁集到邮件列表
FeedBack: The patch(es) which you have sent to kernel@openeuler.org has been converted to PR failed! Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/X... Failed Reason: the cover of the patches is missing Suggest Solution: please checkout and apply the patches' cover and send all again