diff mbox series

[RFC,16/16] sched/fair: Consider kthread debt in cputime

Message ID 20220106004656.126790-17-daniel.m.jordan@oracle.com (mailing list archive)
State RFC
Delegated to: Herbert Xu
Headers show
Series padata, vfio, sched: Multithreaded VFIO page pinning | expand

Commit Message

Daniel Jordan Jan. 6, 2022, 12:46 a.m. UTC
kthreads that charge their CPU time to a remote task group should be
accounted for in cgroup's cputime statistics.

Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
---
 kernel/sched/fair.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3c2d7f245c68..b3ebb34c475b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11524,6 +11524,11 @@  static void cpu_cgroup_remote(struct task_struct *p, struct task_group *tg,
 			goto out;
 
 		incur_cfs_debt(rq, se, tg, debt);
+
+		/* cputime accounting is only supported in cgroup2. */
+		__cgroup_account_cputime(tg->css.cgroup, debt);
+		__cgroup_account_cputime_field(tg->css.cgroup, CPUTIME_SYSTEM,
+					       debt);
 	}
 
 out: