[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251221232926.450602-6-mathieu.desnoyers@efficios.com>
Date: Sun, 21 Dec 2025 18:29:26 -0500
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Mark Brown <broonie@...nel.org>,
linux-mm@...ck.org
Subject: [PATCH v1 5/5] tsacct: Skip all kernel threads
When we hit acct_account_cputime within a irq handler over a kthread
that happens to use a userspace mm, we end up summing up the mm's RSS
into the tsk acct_rss_mem1, which eventually decays.
I don't see a good rationale behind tracking the mm's rss in that way
when a kthread use a userspace mm temporarily through use_mm.
It causes issues with init_mm and efi_mm which only partially initialize
their mm_struct.
Skip all kernel threads in acct_account_cputime(), not just those that
happen to have a NULL mm.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Mark Brown <broonie@...nel.org>
Cc: linux-mm@...ck.org
---
kernel/tsacct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 6ea2f6363b90..3ef149b1245d 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -125,7 +125,7 @@ static void __acct_update_integrals(struct task_struct *tsk,
{
u64 time, delta;
- if (!likely(tsk->mm))
+ if (!tsk->mm || (tsk->flags & PF_KTHREAD))
return;
time = stime + utime;
--
2.39.5
Powered by blists - more mailing lists