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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190722073840.32613-2-alex.shi@linux.alibaba.com>
Date:   Mon, 22 Jul 2019 15:38:40 +0800
From:   Alex Shi <alex.shi@...ux.alibaba.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Alex Shi <alex.shi@...ux.alibaba.com>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Frederic Weisbecker <fweisbec@...il.com>,
        Wanpeng Li <wanpeng.li@...mail.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: [PATCH v3 2/2] cputime: remove rq parameter from irqtime_account_process_tick func

Using the per cpu rq in function internal is better and meaningful, don't
need get and pass it from outside as a parameter.

It also reduce the object size. with defconfig + CONFIG_IRQ_TIME_ACCOUNTING
             base		with this patch
cputime.o    10632 bytes	10568 bytes

Signed-off-by: Alex Shi <alex.shi@...ux.alibaba.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Wanpeng Li <wanpeng.li@...mail.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org
---
 kernel/sched/cputime.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 5086b24d7bee..4e7a1841be86 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -354,9 +354,10 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
  * softirq as those do not count in task exec_runtime any more.
  */
 static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
-					 struct rq *rq, int ticks)
+					 int ticks)
 {
 	u64 other, cputime = TICK_NSEC * ticks;
+	struct rq *rq;
 
 	/*
 	 * When returning from idle, many ticks can get accounted at
@@ -370,6 +371,7 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 		return;
 
 	cputime -= other;
+	rq = this_rq();
 
 	if (this_cpu_ksoftirqd() == p) {
 		/*
@@ -392,9 +394,7 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 static void irqtime_account_idle_ticks(int ticks)
 {
-	struct rq *rq = this_rq();
-
-	irqtime_account_process_tick(current, 0, rq, ticks);
+	irqtime_account_process_tick(current, 0, ticks);
 }
 #else /* CONFIG_IRQ_TIME_ACCOUNTING */
 static inline void irqtime_account_idle_ticks(int ticks) { }
@@ -472,12 +472,10 @@ void thread_group_cputime_adjusted(struct task_struct *p, u64 *ut, u64 *st)
  */
 void account_process_tick(struct task_struct *p, int user_tick)
 {
-	struct rq *rq = this_rq();
-
 	if (vtime_accounting_cpu_enabled())
 		return;
 
-	irqtime_account_process_tick(p, user_tick, rq, 1);
+	irqtime_account_process_tick(p, user_tick, 1);
 }
 
 /*
-- 
2.19.1.856.g8858448bb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ