[PATCH linux-next] sched/psi: Avoid update triggers and rtpoll_total when it is unnecessary

From: yang.yang29
Date: Wed Sep 13 2023 - 08:44:35 EST


From: Yang Yang <yang.yang29@xxxxxxxxxx>

When psimon wakes up and there are no state changes for rtpoll_states,
it's unnecessary to update triggers and rtpoll_total because the pressures
being monitored by user have not changed.

Signed-off-by: Yang Yang <yang.yang29@xxxxxxxxxx>
---
kernel/sched/psi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 81fca77397f6..e4463bb267c3 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -701,7 +701,7 @@ static void psi_rtpoll_work(struct psi_group *group)
goto out;
}

- if (now >= group->rtpoll_next_update) {
+ if ((changed_states & group->rtpoll_states) && (now >= group->rtpoll_next_update)) {
group->rtpoll_next_update = update_triggers(group, now, &update_total, PSI_POLL);
if (update_total)
memcpy(group->rtpoll_total, group->total[PSI_POLL],
--
2.25.1