mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] sched/cputime: clean up common vtime APIs
@ 2024-04-11 12:19 Changbin Du
  0 siblings, 0 replies; only message in thread
From: Changbin Du @ 2024-04-11 12:19 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Valentin Schneider, linux-kernel,
	Changbin Du

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-11 12:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11 12:19 [PATCH v2] sched/cputime: clean up common vtime APIs Changbin Du

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®