[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240411121948.2154391-1-changbin.du@huawei.com>
Date: Thu, 11 Apr 2024 20:19:48 +0800
From: Changbin Du <changbin.du@...wei.com>
To: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot
<vincent.guittot@...aro.org>
CC: Dietmar Eggemann <dietmar.eggemann@....com>, Steven Rostedt
<rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman
<mgorman@...e.de>, Daniel Bristot de Oliveira <bristot@...hat.com>, Valentin
Schneider <vschneid@...hat.com>, <linux-kernel@...r.kernel.org>, Changbin Du
<changbin.du@...wei.com>
Subject: [PATCH v2] 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.
Signed-off-by: Changbin Du <changbin.du@...wei.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
Powered by blists - more mailing lists