htop icon indicating copy to clipboard operation
htop copied to clipboard

Linux: `/proc/<pid>/status` refactor no2

Open cgzones opened this issue 1 year ago • 2 comments

#1211 showed reading /proc/<pid>/status might have a significant performance impact. Do not read by default only if actually needed, since the permitted capabilities are no longer gather from it.

Improves: https://github.com/htop-dev/htop/commit/8ea144df7494bad0c46d3bf4f16c9a6556c500d2 ("Linux: Refactor /proc//status parsing") Improves: https://github.com/htop-dev/htop/issues/1211

cgzones avatar Apr 12 '23 18:04 cgzones

Can we just detect container status once per process instead of per thread? According to pid_namespaces(7), threads are required to be in the same PID namespace, so doing that once per thread seems to be extra work with no gain.

tanriol avatar Apr 13 '23 08:04 tanriol

@cgzones What's missing from this branch to be ready?

BenBE avatar Dec 11 '23 09:12 BenBE

@cgzones Thank you very much for these Patches. We would love to try these in production. This PR only applies to current upstream and not latest 3.3.0 release. Since we are unfortunately not as firm with C we can only do so much as to rebuild the debian package for 3.3.0 with a patch applied. This fails when trying this PR for obvious reasons since it has been based on latest upstream master, which apparently includes some significant changes compared to 3.3.0.

So may I ask you in case this is not a lot of effort, could you provide with a patch which includes your improvements and cleanly applies to release 3.3.0? Thanks so much in advance!

kartoffelheinz avatar Mar 19 '24 13:03 kartoffelheinz

@kartoffelheinz The code in linux/LinuxProcessTable.c changed quite a lot with conflicting changes, so at the moment I am unable to supply rebased patches for 3.3.0.

cgzones avatar Mar 27 '24 19:03 cgzones