Skip to contentSkip to conversation

sched/cputime: clean up common vtime APIs

PATCH New Changbin Du 1 participant 1 message Apr 11, 2024 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sched/cputime: clean up common vtime APIs

This removes the vtime_account_kernel() and vtime_account_idle() functions in generic vtime accounting. There's no common vtime APIs now.

---
v2: also remove vtime_account_idle.

---
 include/linux/vtime.h  | 11 +++--------
 kernel/sched/cputime.c | 19 +------------------
 2 files changed, 4 insertions(+), 26 deletions(-)
include/linux/vtime.h +3 -8
index 3684487d01e1..005d0870e41b 100644
@@ -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);
kernel/sched/cputime.c +1 -18
index af7952f12e6c..353b3b4c19da 100644
@@ -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;
Signature · 1 line
2.34.1