[PATCH v2] sched/cputime: clean up common vtime APIs

Changbin Du posted 1 patch 1 year, 10 months ago
include/linux/vtime.h  | 11 +++--------
kernel/sched/cputime.c | 19 +------------------
2 files changed, 4 insertions(+), 26 deletions(-)
[PATCH v2] sched/cputime: clean up common vtime APIs
Posted by Changbin Du 1 year, 10 months ago
This removes the vtime_account_kernel() and vtime_account_idle() functions
in generic vtime accounting. There's no common vtime APIs now.

Signed-off-by: Changbin Du <changbin.du@huawei.com>

---
v2: also remove vtime_account_idle.
---
 include/linux/vtime.h  | 11 +++--------
 kernel/sched/cputime.c | 19 +------------------
 2 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 3684487d01e1..005d0870e41b 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -9,14 +9,6 @@
 #include <asm/vtime.h>
 #endif
 
-/*
- * Common vtime APIs
- */
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING
-extern void vtime_account_kernel(struct task_struct *tsk);
-extern void vtime_account_idle(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);
 extern void vtime_user_enter(struct task_struct *tsk);
@@ -52,6 +44,9 @@ static inline void vtime_flush(struct task_struct *tsk) { }
 static inline bool vtime_accounting_enabled_this_cpu(void) { return true; }
 extern void vtime_task_switch(struct task_struct *prev);
 
+extern void vtime_account_kernel(struct task_struct *tsk);
+extern void vtime_account_idle(struct task_struct *tsk);
+
 static __always_inline void vtime_account_guest_enter(void)
 {
 	vtime_account_kernel(current);
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index af7952f12e6c..353b3b4c19da 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -709,18 +709,6 @@ static void __vtime_account_kernel(struct task_struct *tsk,
 		vtime_account_system(tsk, vtime);
 }
 
-void vtime_account_kernel(struct task_struct *tsk)
-{
-	struct vtime *vtime = &tsk->vtime;
-
-	if (!vtime_delta(vtime))
-		return;
-
-	write_seqcount_begin(&vtime->seqcount);
-	__vtime_account_kernel(tsk, vtime);
-	write_seqcount_end(&vtime->seqcount);
-}
-
 void vtime_user_enter(struct task_struct *tsk)
 {
 	struct vtime *vtime = &tsk->vtime;
@@ -775,18 +763,13 @@ void vtime_guest_exit(struct task_struct *tsk)
 }
 EXPORT_SYMBOL_GPL(vtime_guest_exit);
 
-void vtime_account_idle(struct task_struct *tsk)
-{
-	account_idle_time(get_vtime_delta(&tsk->vtime));
-}
-
 void vtime_task_switch_generic(struct task_struct *prev)
 {
 	struct vtime *vtime = &prev->vtime;
 
 	write_seqcount_begin(&vtime->seqcount);
 	if (vtime->state == VTIME_IDLE)
-		vtime_account_idle(prev);
+		account_idle_time(get_vtime_delta(&prev->vtime));
 	else
 		__vtime_account_kernel(prev, vtime);
 	vtime->state = VTIME_INACTIVE;
-- 
2.34.1