Messages in this thread Patch in this message | | | From | Domenico Cerasuolo <> | Subject | [PATCH 3/4] sched/psi: extract update_triggers side effect | Date | Thu, 9 Mar 2023 18:07:55 +0100 |
| |
The update of rtpoll_total inside update_triggers can be moved out of the function since changed_states has the same information as the update_total flag used in the function. Besides the simplification of the function, with the next patch it would become an unwanted side effect needed only for PSI_POLL.
Suggested-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Domenico Cerasuolo <cerasuolodomenico@gmail.com> --- kernel/sched/psi.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index a3d0b5cf797a..476941c1cbea 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -433,7 +433,6 @@ static u64 window_update(struct psi_window *win, u64 now, u64 value) static u64 update_triggers(struct psi_group *group, u64 now) { struct psi_trigger *t; - bool update_total = false; u64 *total = group->total[PSI_POLL]; /* @@ -456,14 +455,6 @@ static u64 update_triggers(struct psi_group *group, u64 now) * events without dropping any). */ if (new_stall) { - /* - * Multiple triggers might be looking at the same state, - * remember to update group->polling_total[] once we've - * been through all of them. Also remember to extend the - * polling time if we see new stall activity. - */ - update_total = true; - /* Calculate growth since last update */ growth = window_update(&t->win, now, total[t->state]); if (!t->pending_event) { @@ -484,11 +475,6 @@ static u64 update_triggers(struct psi_group *group, u64 now) /* Reset threshold breach flag once event got generated */ t->pending_event = false; } - - if (update_total) - memcpy(group->rtpoll_total, total, - sizeof(group->rtpoll_total)); - return now + group->rtpoll_min_period; } @@ -686,8 +672,12 @@ static void psi_rtpoll_work(struct psi_group *group) goto out; } - if (now >= group->rtpoll_next_update) + if (now >= group->rtpoll_next_update) { group->rtpoll_next_update = update_triggers(group, now); + if (changed_states & group->rtpoll_states) + memcpy(group->rtpoll_total, group->total[PSI_POLL], + sizeof(group->rtpoll_total)); + } psi_schedule_rtpoll_work(group, nsecs_to_jiffies(group->rtpoll_next_update - now) + 1, -- 2.34.1
| |