Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1442528

[PATCH 4/5] sched: Reorganize vtime native irqtime accounting headers

From Frederic Weisbecker <fweisbec@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 4/5] sched: Reorganize vtime native irqtime accounting headers
Date 2016-07-13 17:00 +0200
Message-ID <rUtNM-4qs-37@gated-at.bofh.it> (permalink)
References <rUtNM-4qs-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The vtime irqtime accounting headers are very scattered and convoluted
right now. Reorganize them such that it is obvious that only
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE does use it.

Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 include/linux/vtime.h | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 65aef5e..aa9bfea 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -12,12 +12,9 @@ struct task_struct;
 /*
  * vtime_accounting_cpu_enabled() definitions/declarations
  */
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
+#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE)
 static inline bool vtime_accounting_cpu_enabled(void) { return true; }
-extern void vtime_account_irq_enter(struct task_struct *tsk);
-#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
-
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
+#elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN)
 /*
  * Checks if vtime is enabled on some CPU. Cputime readers want to be careful
  * in that case and compute the tickless cputime.
@@ -38,11 +35,9 @@ static inline bool vtime_accounting_cpu_enabled(void)
 
 	return false;
 }
-#endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
-
-#ifndef CONFIG_VIRT_CPU_ACCOUNTING
+#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
 static inline bool vtime_accounting_cpu_enabled(void) { return false; }
-#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
+#endif
 
 
 /*
@@ -70,14 +65,10 @@ extern void vtime_account_user(struct task_struct *tsk);
 static inline void vtime_task_switch(struct task_struct *prev) { }
 static inline void vtime_account_system(struct task_struct *tsk) { }
 static inline void vtime_account_user(struct task_struct *tsk) { }
-static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
 #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
 extern void arch_vtime_task_switch(struct task_struct *tsk);
-static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
-static inline void vtime_account_irq_exit(struct task_struct *tsk) { }
-
 extern void vtime_user_enter(struct task_struct *tsk);
 
 static inline void vtime_user_exit(struct task_struct *tsk)
@@ -88,11 +79,6 @@ extern void vtime_guest_enter(struct task_struct *tsk);
 extern void vtime_guest_exit(struct task_struct *tsk);
 extern void vtime_init_idle(struct task_struct *tsk, int cpu);
 #else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN  */
-static inline void vtime_account_irq_exit(struct task_struct *tsk)
-{
-	/* On hard|softirq exit we always account to hard|softirq cputime */
-	vtime_account_system(tsk);
-}
 static inline void vtime_user_enter(struct task_struct *tsk) { }
 static inline void vtime_user_exit(struct task_struct *tsk) { }
 static inline void vtime_guest_enter(struct task_struct *tsk) { }
@@ -100,6 +86,19 @@ static inline void vtime_guest_exit(struct task_struct *tsk) { }
 static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { }
 #endif
 
+#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
+extern void vtime_account_irq_enter(struct task_struct *tsk);
+static inline void vtime_account_irq_exit(struct task_struct *tsk)
+{
+	/* On hard|softirq exit we always account to hard|softirq cputime */
+	vtime_account_system(tsk);
+}
+#else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
+static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
+static inline void vtime_account_irq_exit(struct task_struct *tsk) { }
+#endif
+
+
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 extern void irqtime_account_irq(struct task_struct *tsk);
 #else
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL] cputime fixes and cleanups Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-13 17:00 +0200
  [PATCH 2/5] nohz,cputime: Replace VTIME_GEN irq time code with IRQ_TIME_ACCOUNTING code Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-13 17:00 +0200
    [tip:timers/nohz] sched/cputime: Replace VTIME_GEN irq time code  with IRQ_TIME_ACCOUNTING code tip-bot for Rik van Riel <tipbot@zytor.com> - 2016-07-14 12:40 +0200
  [PATCH 4/5] sched: Reorganize vtime native irqtime accounting headers Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-13 17:00 +0200
    [tip:timers/nohz] sched/cputime: Reorganize vtime native irqtime  accounting headers tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2016-07-14 12:40 +0200
  [PATCH 5/5] time: Drop local_irq_save/restore from irqtime_account_irq Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-13 17:00 +0200
    [tip:timers/nohz] sched/cputime: Drop local_irq_save/restore from  irqtime_account_irq() tip-bot for Rik van Riel <tipbot@zytor.com> - 2016-07-14 12:40 +0200
  [PATCH 3/5] sched: Complete cleanup of old vtime gen irqtime accounting Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-13 17:00 +0200
    [tip:timers/nohz] sched/cputime: Clean up the old vtime gen irqtime  accounting completely tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2016-07-14 12:40 +0200
  [PATCH 1/5] sched,time: Count actually elapsed irq & softirq time Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-13 17:00 +0200
    [tip:timers/nohz] sched/cputime: Count actually elapsed irq &  softirq time tip-bot for Rik van Riel <tipbot@zytor.com> - 2016-07-14 12:40 +0200

csiph-web