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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 9 Jan 2020 21:30:40 +0800
From:   Alex Shi <alex.shi@...ux.alibaba.com>
To:     Peter Zijlstra <peterz@...radead.org>,
        Frederic Weisbecker <frederic@...nel.org>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Frederic Weisbecker <fweisbec@...il.com>,
        Wanpeng Li <wanpeng.li@...mail.com>,
        Anna-Maria Gleixner <anna-maria@...utronix.de>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] sched/cputime: code cleanup in
 irqtime_account_process_tick


>> I fear we can't really play the exact same game as account_process_tick() here.
>> Since this is irqtime precise accounting, we have already computed the
>> irqtime delta in account_other_time() (or we will at some point in the future)
>> and substracted it from the ticks to account. This means that the remaining cputime
>> to account has to be either utime/stime/gtime/idle-time but not interrupt time, or
>> we may account interrupt time twice. And account_system_time() tries to account
>> irq time, for example if we interrupt a softirq.
> 
> OK, I've dropped 2 and 3. Thanks Frederic!
> 

Hi Frederic & Peter,

Thanks a lot for the comments and review! 
It's my fault to mess up the account_system_time details. And seems there is no easy way to replace irqtime_account_process_tick or account_process_tick with each other.

but on the other side, the account_idle_ticks could be replaced by irqtime_account_process_tick, or at least to remove irqtime_account_idle_ticks function. Any comments?

Thanks
Alex

---

>From 7073e60babc3b42a987b4e89f380956887734233 Mon Sep 17 00:00:00 2001
From: Alex Shi <alex.shi@...ux.alibaba.com>
Date: Thu, 9 Jan 2020 20:32:55 +0800
Subject: [PATCH] sched/cputime: remove irqtime_account_idle_ticks

irqtime_account_idle_ticks and irqtime_account_process_tick use in same
condition. We don't bother to name and use a irqtime_account_idle_ticks
for only one calling. Remove the function to simply code and reduce a
bit object size of kernel.

And further more, we could replace account_idle_ticks by
irqtime_account_process_tick too. But feed and check 'current' looks weird.
So this is ok.

Signed-off-by: Alex Shi <alex.shi@...ux.alibaba.com>
Cc: Frederic Weisbecker <frederic@...nel.org>
Cc: Ingo Molnar <mingo@...hat.com> 
Cc: Peter Zijlstra <peterz@...radead.org> 
Cc: linux-kernel@...r.kernel.org 
---
 kernel/sched/cputime.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index cff3e656566d..17640d145e44 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -390,12 +390,7 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 	}
 }
 
-static void irqtime_account_idle_ticks(int ticks)
-{
-	irqtime_account_process_tick(current, 0, ticks);
-}
 #else /* CONFIG_IRQ_TIME_ACCOUNTING */
-static inline void irqtime_account_idle_ticks(int ticks) { }
 static inline void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 						int nr_ticks) { }
 #endif /* CONFIG_IRQ_TIME_ACCOUNTING */
@@ -505,7 +500,7 @@ void account_idle_ticks(unsigned long ticks)
 	u64 cputime, steal;
 
 	if (sched_clock_irqtime) {
-		irqtime_account_idle_ticks(ticks);
+		irqtime_account_process_tick(current, 0, ticks);
 		return;
 	}
 
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ