lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <MEYP282MB4026EFAAF1DEBD5EE8EBE072C3389@MEYP282MB4026.AUSP282.PROD.OUTLOOK.COM>
Date:   Thu,  3 Nov 2022 10:18:38 +0800
From:   johnnyaiai <arafatms@...look.com>
To:     akpm@...ux-foudation.org
Cc:     mcgrof@...nel.org, wuchi.zero@...il.com, liaohua4@...wei.com,
        linux-kernel@...r.kernel.org, johnnyaiai <johnnyaiai@...cent.com>
Subject: [PATCH] latencytop: Remove clear operations from copy_process

From: johnnyaiai <johnnyaiai@...cent.com>

clear_tsk_latency_tracing will called wheather latencytop_enabled
set or not. this bring unnecessary overhead.

Signed-off-by: johnnyaiai <johnnyaiai@...cent.com>
---
 kernel/latencytop.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/kernel/latencytop.c b/kernel/latencytop.c
index e3acead00..daa65b313 100644
--- a/kernel/latencytop.c
+++ b/kernel/latencytop.c
@@ -63,14 +63,15 @@ static struct latency_record latency_record[MAXLR];
 
 int latencytop_enabled;
 
-void clear_tsk_latency_tracing(struct task_struct *p)
+static void _clear_tsk_latency_tracing(struct task_struct *p)
 {
-	unsigned long flags;
-
-	raw_spin_lock_irqsave(&latency_lock, flags);
 	memset(&p->latency_record, 0, sizeof(p->latency_record));
 	p->latency_record_count = 0;
-	raw_spin_unlock_irqrestore(&latency_lock, flags);
+}
+
+void clear_tsk_latency_tracing(struct task_struct *p)
+{
+	p->latency_record_count = LT_SAVECOUNT + 1;
 }
 
 static void clear_global_latency_tracing(void)
@@ -172,6 +173,9 @@ __account_scheduler_latency(struct task_struct *tsk, int usecs, int inter)
 
 	raw_spin_lock_irqsave(&latency_lock, flags);
 
+	if (unlikely(tsk->latency_record_count == (LT_SAVECOUNT + 1)))
+		_clear_tsk_latency_tracing(tsk);
+
 	account_global_scheduler_latency(tsk, &lat);
 
 	for (i = 0; i < tsk->latency_record_count; i++) {
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ