From: wuchi Date: Sat, 3 Sep 2022 13:52:33 +0000 (+0800) Subject: latencytop: use the last element of latency_record of system X-Git-Tag: v6.1-rc1~45^2~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b814751175470b00969a317bf3192260750f9455;p=thirdparty%2Fkernel%2Flinux.git latencytop: use the last element of latency_record of system In account_global_scheduler_latency(), when we don't find the matching latency_record we 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. Link: https://lkml.kernel.org/r/20220903135233.5225-1-wuchi.zero@gmail.com Signed-off-by: wuchi Reviewed-by: Andrew Morton Cc: Alexander Viro Cc: Luis Chamberlain Signed-off-by: Andrew Morton --- diff --git a/kernel/latencytop.c b/kernel/latencytop.c index 76166df011a4d..781249098cb6e 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: */