From nobody Mon Feb 9 12:24:55 2026 Received: from smtpout.efficios.com (smtpout.efficios.com [158.69.130.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 567BB27E05A for ; Sun, 21 Dec 2025 23:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=158.69.130.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766359796; cv=none; b=DmgcWGSbdnkQHDPib/Hfa3GoR2tTz4GIUuWUvCxvDvtvGjBD9QBt44TgUG2tbIhpnaSHfavLOpUotX8t1ccAmdL6gaMOnkcXntlQnu/yjQVL0vIWx7a61Lk4Ffa/nCeAvWAWiEqcXg3sEbGK3iGcVPpNV8vrlmKrO/Iqf6z33Dg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766359796; c=relaxed/simple; bh=YyBuFGysnlGk6QkasmTb9UZ3Q8qqhsfrWdFqLi9lNpg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BZV9rp5ku8/1CjpSVNXyYNeGWvAMqrkiR+zWH7b9dMiPdJlVuzMRf1QHnw/G+9OKh7E63ABAi0etSmCgIlOyA6IXEsO87Njcs799595jmZ2piyjAWbtjqsrv8dbvBW+yqjnkzjxL0eJqy/p2hZwucC6b9RsXZnBf7cY1nNtw1qg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=PgvMIKuY; arc=none smtp.client-ip=158.69.130.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="PgvMIKuY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1766359786; bh=1MzIdp3++EW9jR4viQGn26PxJ/MrNC9X0AWB2R5jbVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PgvMIKuYdwYykqjiye99wCEJvGuExeaBUNDMjDguc7hFesZEMFSdm/2nW/1SSChe9 5Z0i342gnbxzO16o5nyWloqRENbS7jfJHEwdlgrSDwoFr0d2+QsnyHMAuyOAlIVeJA ROintfIlZR7cXHH9Za4jX7CklcshWfGwMBQaftb35GItWNVX/Du0sgbktalF5yc1UV 6X6WJu8UdmobHf62Yx4cPbBZtN6hQN6PUkgaZZHj1AtsleHeLj5atxEG9RJiML6BPp X3wm9zUK9kRTDTNiWGr7bQILaBg6IBHRL8Wls0hLCFV8FqVPrazBcNIJ7bjdaha2qd gdI8ZqE/DqG7A== Received: from thinkos.internal.efficios.com (unknown [IPv6:2606:6d00:100:4000:6450:b8a1:16cf:5ecf]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4dZHYQ43gczcBx; Sun, 21 Dec 2025 18:29:46 -0500 (EST) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Mark Brown , linux-mm@kvack.org Subject: [PATCH v1 5/5] tsacct: Skip all kernel threads Date: Sun, 21 Dec 2025 18:29:26 -0500 Message-Id: <20251221232926.450602-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251221232926.450602-1-mathieu.desnoyers@efficios.com> References: <20251221232926.450602-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Cc: Andrew Morton Cc: Mark Brown Cc: linux-mm@kvack.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; =20 - if (!likely(tsk->mm)) + if (!tsk->mm || (tsk->flags & PF_KTHREAD)) return; =20 time =3D stime + utime; --=20 2.39.5