Skip to contentSkip to conversation

sched: add #ifdef around irq time accounting functions

PATCH/resend In review Heiko Carstens 2 participants 5 messages Feb 25, 2011 – Feb 26, 2011 Linux-next tree

lore
Share & tools
lore
#0 lore raw

From: Heiko Carstens <[email protected]>

Get rid of this:

kernel/sched.c:3731:13: warning: 'irqtime_account_idle_ticks' defined but not used kernel/sched.c:3732:13: warning: 'irqtime_account_process_tick' defined but not used

Cc Venkatesh Pallipadi <[email protected]>

---

Resending, because I screwed up Peter's email address... Patch is against linux-next.

 kernel/sched.c |    2 ++
 1 file changed, 2 insertions(+)
kernel/sched.c +2 -0
@@ -3666,6 +3666,7 @@ void account_system_time(struct task_str
 	__account_system_time(p, cputime, cputime_scaled, target_cputime64);
 }
 
+#ifndef CONFIG_VIRT_CPU_ACCOUNTING
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 /*
  * Account a tick to a process and cpustat
@@ -3732,6 +3733,7 @@ static void irqtime_account_idle_ticks(i
 static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 						struct rq *rq) {}
 #endif
+#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
 
 /*
  * Account for involuntary wait time.
#1 lore raw

[tip:sched/core] sched: Add #ifdef around irq time accounting functions

Commit-ID:  7e9498705e810404ecf29bb2d6fa632b9484c609
Gitweb:     http://git.kernel.org/tip/7e9498705e810404ecf29bb2d6fa632b9484c609
Author:     Heiko Carstens <[email protected]>
AuthorDate: Fri, 25 Feb 2011 14:32:28 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 25 Feb 2011 14:39:48 +0100

sched: Add #ifdef around irq time accounting functions

Get rid of this:

kernel/sched.c:3731:13: warning: 'irqtime_account_idle_ticks' defined but not used kernel/sched.c:3732:13: warning: 'irqtime_account_process_tick' defined but not used

Cc Venkatesh Pallipadi <[email protected]>
Cc Peter Zijlstra <[email protected]>

LKML-Reference: <[email protected]>

---
 kernel/sched.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sched.c +2 -0
index 2effcb7..79bca16 100644
@@ -3687,6 +3687,7 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
 	__account_system_time(p, cputime, cputime_scaled, target_cputime64);
 }
 
+#ifndef CONFIG_VIRT_CPU_ACCOUNTING
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 /*
  * Account a tick to a process and cpustat
@@ -3753,6 +3754,7 @@ static void irqtime_account_idle_ticks(int ticks) {}
 static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 						struct rq *rq) {}
 #endif
+#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
 
 /*
  * Account for involuntary wait time.
#2 lore raw

Re: [tip:sched/core] sched: Add #ifdef around irq time accounting functions

Quoted 8 lines · tip-bot for Heiko Carstens

Commit-ID:  7e9498705e810404ecf29bb2d6fa632b9484c609
Gitweb:     http://git.kernel.org/tip/7e9498705e810404ecf29bb2d6fa632b9484c609
Author:     Heiko Carstens <[email protected]>
AuthorDate: Fri, 25 Feb 2011 14:32:28 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 25 Feb 2011 14:39:48 +0100

sched: Add #ifdef around irq time accounting functions

I had a slightly different and I think a bit cleaner patch to address the same problem earlier here
https://lkml.org/lkml/2011/1/31/363

Can you please take that patch instead of this one.

Thanks,
Venki

Quoted 36 lines

Get rid of this:

 kernel/sched.c:3731:13: warning: 'irqtime_account_idle_ticks' defined but not used kernel/sched.c:3732:13: warning: 'irqtime_account_process_tick' defined but not used

Cc Venkatesh Pallipadi <[email protected]>
Cc Peter Zijlstra <[email protected]>

LKML-Reference: <[email protected]>

---
 kernel/sched.c |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sched.c +2 -0
index 2effcb7..79bca16 100644
@@ -3687,6 +3687,7 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
        __account_system_time(p, cputime, cputime_scaled, target_cputime64);
  }
 
+#ifndef CONFIG_VIRT_CPU_ACCOUNTING
  #ifdef CONFIG_IRQ_TIME_ACCOUNTING
  /*
  * Account a tick to a process and cpustat
@@ -3753,6 +3754,7 @@ static void irqtime_account_idle_ticks(int ticks) {}
  static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
                                                struct rq *rq) {}
  #endif
+#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
 
  /*
  * Account for involuntary wait time.
#3 lore raw

PATCH 1/1 sched: Minor IRQ_TIME_ACCOUNTING code layout change

There was a warning reported here
lkml.org/lkml/2011/1/30/124

kernel/sched.c:3719: warning: 'irqtime_account_idle_ticks' defined but not used kernel/sched.c:3720: warning: 'irqtime_account_process_tick' defined but not used

The patch on that thread here
https://lkml.org/lkml/2011/1/31/363

Added the needed ifdef and also moved the code around a bit to make it easy to follow. Here is the refresh of that patch on latest tip.

This patch will not have any functional impact. Just the code layout change.

---
 kernel/sched.c |   64 +++++++++++++++++++++++++++----------------------------
 1 files changed, 31 insertions(+), 33 deletions(-)
kernel/sched.c +31 -33
index 36e936d..5fb5aa2 100644
@@ -3666,7 +3666,36 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
 	__account_system_time(p, cputime, cputime_scaled, target_cputime64);
 }
 
+/*
+ * Account for involuntary wait time.
+ * @cputime: the cpu time spent in involuntary wait
+ */
+void account_steal_time(cputime_t cputime)
+{
+	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+	cputime64_t cputime64 = cputime_to_cputime64(cputime);
+
+	cpustat->steal = cputime64_add(cpustat->steal, cputime64);
+}
+
+/*
+ * Account for idle time.
+ * @cputime: the cpu time spent in idle wait
+ */
+void account_idle_time(cputime_t cputime)
+{
+	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+	cputime64_t cputime64 = cputime_to_cputime64(cputime);
+	struct rq *rq = this_rq();
+
+	if (atomic_read(&rq->nr_iowait) > 0)
+		cpustat->iowait = cputime64_add(cpustat->iowait, cputime64);
+	else
+		cpustat->idle = cputime64_add(cpustat->idle, cputime64);
+}
+
 #ifndef CONFIG_VIRT_CPU_ACCOUNTING
+
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 /*
  * Account a tick to a process and cpustat
@@ -3728,42 +3757,11 @@ static void irqtime_account_idle_ticks(int ticks)
 	for (i = 0; i < ticks; i++)
 		irqtime_account_process_tick(current, 0, rq);
 }
-#else
+#else /* CONFIG_IRQ_TIME_ACCOUNTING */
 static void irqtime_account_idle_ticks(int ticks) {}
 static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 						struct rq *rq) {}
-#endif
-#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
-
-/*
- * Account for involuntary wait time.
- * @steal: the cpu time spent in involuntary wait
- */
-void account_steal_time(cputime_t cputime)
-{
-	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
-	cputime64_t cputime64 = cputime_to_cputime64(cputime);
-
-	cpustat->steal = cputime64_add(cpustat->steal, cputime64);
-}
-
-/*
- * Account for idle time.
- * @cputime: the cpu time spent in idle wait
- */
-void account_idle_time(cputime_t cputime)
-{
-	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
-	cputime64_t cputime64 = cputime_to_cputime64(cputime);
-	struct rq *rq = this_rq();
-
-	if (atomic_read(&rq->nr_iowait) > 0)
-		cpustat->iowait = cputime64_add(cpustat->iowait, cputime64);
-	else
-		cpustat->idle = cputime64_add(cpustat->idle, cputime64);
-}
-
-#ifndef CONFIG_VIRT_CPU_ACCOUNTING
+#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
 
 /*
  * Account a single tick of cpu time.
Signature · 1 line
1.7.3.1
#4 lore raw

[tip:sched/core] sched: Clean up the IRQ_TIME_ACCOUNTING code

Commit-ID:  544b4a1f309d18f40969dbab7e08bafd136b2f55
Gitweb:     http://git.kernel.org/tip/544b4a1f309d18f40969dbab7e08bafd136b2f55
Author:     Venkatesh Pallipadi <[email protected]>
AuthorDate: Fri, 25 Feb 2011 15:13:16 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 26 Feb 2011 07:59:58 +0100

sched: Clean up the IRQ_TIME_ACCOUNTING code

Fix this warning:

lkml.org/lkml/2011/1/30/124

kernel/sched.c:3719: warning: 'irqtime_account_idle_ticks' defined but not used kernel/sched.c:3720: warning: 'irqtime_account_process_tick' defined but not used

In a cleaner way than:

7e9498705e81: sched: Add #ifdef around irq time accounting functions

This patch will not have any functional impact.

LKML-Reference: <[email protected]>

---
 kernel/sched.c |   64 +++++++++++++++++++++++++++----------------------------
 1 files changed, 31 insertions(+), 33 deletions(-)
kernel/sched.c +31 -33
index 79bca16..0c87126 100644
@@ -3687,7 +3687,36 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
 	__account_system_time(p, cputime, cputime_scaled, target_cputime64);
 }
 
+/*
+ * Account for involuntary wait time.
+ * @cputime: the cpu time spent in involuntary wait
+ */
+void account_steal_time(cputime_t cputime)
+{
+	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+	cputime64_t cputime64 = cputime_to_cputime64(cputime);
+
+	cpustat->steal = cputime64_add(cpustat->steal, cputime64);
+}
+
+/*
+ * Account for idle time.
+ * @cputime: the cpu time spent in idle wait
+ */
+void account_idle_time(cputime_t cputime)
+{
+	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+	cputime64_t cputime64 = cputime_to_cputime64(cputime);
+	struct rq *rq = this_rq();
+
+	if (atomic_read(&rq->nr_iowait) > 0)
+		cpustat->iowait = cputime64_add(cpustat->iowait, cputime64);
+	else
+		cpustat->idle = cputime64_add(cpustat->idle, cputime64);
+}
+
 #ifndef CONFIG_VIRT_CPU_ACCOUNTING
+
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 /*
  * Account a tick to a process and cpustat
@@ -3749,42 +3778,11 @@ static void irqtime_account_idle_ticks(int ticks)
 	for (i = 0; i < ticks; i++)
 		irqtime_account_process_tick(current, 0, rq);
 }
-#else
+#else /* CONFIG_IRQ_TIME_ACCOUNTING */
 static void irqtime_account_idle_ticks(int ticks) {}
 static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 						struct rq *rq) {}
-#endif
-#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
-
-/*
- * Account for involuntary wait time.
- * @steal: the cpu time spent in involuntary wait
- */
-void account_steal_time(cputime_t cputime)
-{
-	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
-	cputime64_t cputime64 = cputime_to_cputime64(cputime);
-
-	cpustat->steal = cputime64_add(cpustat->steal, cputime64);
-}
-
-/*
- * Account for idle time.
- * @cputime: the cpu time spent in idle wait
- */
-void account_idle_time(cputime_t cputime)
-{
-	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
-	cputime64_t cputime64 = cputime_to_cputime64(cputime);
-	struct rq *rq = this_rq();
-
-	if (atomic_read(&rq->nr_iowait) > 0)
-		cpustat->iowait = cputime64_add(cpustat->iowait, cputime64);
-	else
-		cpustat->idle = cputime64_add(cpustat->idle, cputime64);
-}
-
-#ifndef CONFIG_VIRT_CPU_ACCOUNTING
+#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
 
 /*
  * Account a single tick of cpu time.