[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202309141002037888418@zte.com.cn>
Date: Thu, 14 Sep 2023 10:02:03 +0800 (CST)
From: <yang.yang29@....com.cn>
To: <surenb@...gle.com>
Cc: <hannes@...xchg.org>, <mingo@...hat.com>,
<linux-kernel@...r.kernel.org>, <juri.lelli@...hat.com>
Subject: Re: [PATCH linux-next] sched/psi: Avoid update triggers and rtpoll_total when it is unnecessary
> I don't think that's your intention here, it is?
It's an omission, rtpoll_next_update should be update, thanks
for your reviewing. I did a simple test and did not see delay,
maybe it is other reason.
And I read update_triggers() again, it always return
now + group->rtpoll_min_period, and this return
value is only used by psi_rtpoll_work(). So I think
there is no need for update_triggers() to return
value. So what about this version see below:
---
kernel/sched/psi.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 81fca77397f6..b6b8af2cf311 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -434,7 +434,7 @@ static u64 window_update(struct psi_window *win, u64 now, u64 value)
return growth;
}
-static u64 update_triggers(struct psi_group *group, u64 now, bool *update_total,
+static void update_triggers(struct psi_group *group, u64 now, bool *update_total,
enum psi_aggregators aggregator)
{
struct psi_trigger *t;
@@ -499,8 +499,6 @@ static u64 update_triggers(struct psi_group *group, u64 now, bool *update_total,
/* Reset threshold breach flag once event got generated */
t->pending_event = false;
}
-
- return now + group->rtpoll_min_period;
}
static u64 update_averages(struct psi_group *group, u64 now)
@@ -699,10 +697,11 @@ static void psi_rtpoll_work(struct psi_group *group)
if (now > group->rtpoll_until) {
group->rtpoll_next_update = ULLONG_MAX;
goto out;
- }
+ } else
+ group->rtpoll_next_update = now + group->rtpoll_min_period;
- if (now >= group->rtpoll_next_update) {
- group->rtpoll_next_update = update_triggers(group, now, &update_total, PSI_POLL);
+ if ((changed_states & group->rtpoll_states) && (now >= group->rtpoll_next_update)) {
+ update_triggers(group, now, &update_total, PSI_POLL);
if (update_total)
memcpy(group->rtpoll_total, group->total[PSI_POLL],
sizeof(group->rtpoll_total));
--
2.25.1
Powered by blists - more mailing lists