public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] latencytop: use the last element of latency_record of system
@ 2022-09-03 13:52 wuchi
  0 siblings, 0 replies; only message in thread
From: wuchi @ 2022-09-03 13:52 UTC (permalink / raw)
  To: mcgrof, viro, akpm; +Cc: linux-kernel

In function account_global_scheduler_latency(), when we don't find
the matching latency_record, try to select one which is unused in
latency_record[MAXLR], but the condition will skip the last one.

if (i >= MAXLR-1)

Fix that.

Signed-off-by: wuchi <wuchi.zero@gmail.com>
---
 kernel/latencytop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/latencytop.c b/kernel/latencytop.c
index 76166df011a4..781249098cb6 100644
--- a/kernel/latencytop.c
+++ b/kernel/latencytop.c
@@ -112,7 +112,7 @@ static void __sched
 account_global_scheduler_latency(struct task_struct *tsk,
 				 struct latency_record *lat)
 {
-	int firstnonnull = MAXLR + 1;
+	int firstnonnull = MAXLR;
 	int i;
 
 	/* skip kernel threads for now */
@@ -150,7 +150,7 @@ account_global_scheduler_latency(struct task_struct *tsk,
 	}
 
 	i = firstnonnull;
-	if (i >= MAXLR - 1)
+	if (i >= MAXLR)
 		return;
 
 	/* Allocted a new one: */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-03 13:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-03 13:52 [PATCH] latencytop: use the last element of latency_record of system wuchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox