Hierarchical percpu counters preparation
cover Hierarchical percpu counters preparation
Hi Andrew,
This patch is a preparation step for HPCC, for the OOM killer improvements. I suspect that this patch is useful on its own, because it really makes no sense to sum up accounting statistics of use_mm within kernel threads which are only temporarily using those mm.
Thanks,
Mathieu
Mathieu Desnoyers (1):
tsacct: Skip all kernel threads
kernel/tsacct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.39.5
PATCH 1/1 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 when introducing the new hierarchical percpu counters to replace RSS counters, which requires a pointer dereference when reading the approximate counter sum. The current percpu counters simply load a zeroed atomic counter, which happen to work.
Skip all kernel threads in acct_account_cputime(), not just those that happen to have a NULL mm.
This is a preparation step before introducing the hierarchical percpu counters.
--- kernel/tsacct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/tsacct.c +1 -1
@@ -125,7 +125,7 @@ static void __acct_update_integrals(struct task_struct *tsk, {u64 time, delta; -if (!likely (tsk->mm)) +if (unlikely (!tsk->mm || (tsk->flags &PF_KTHREAD )))return ; time = stime + utime;
Signature · 1 line
2.39.5