From: Changbin Du <changbin.du@huawei.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
<linux-kernel@vger.kernel.org>,
Changbin Du <changbin.du@huawei.com>
Subject: [PATCH v2] sched/cputime: clean up common vtime APIs
Date: Thu, 11 Apr 2024 20:19:48 +0800 [thread overview]
Message-ID: <20240411121948.2154391-1-changbin.du@huawei.com> (raw)
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
reply other threads:[~2024-04-11 12:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240411121948.2154391-1-changbin.du@huawei.com \
--to=changbin.du@huawei.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®