Re: [PATCH] hung_task: Migrate hung_task_detect_count to sysfs

From: Lance Yang

Date: Sun Nov 30 2025 - 22:09:03 EST




On 2025/12/1 01:11, Aaron Tomlin wrote:
On Sun, Nov 30, 2025 at 01:43:51PM +0800, Lance Yang wrote:
Hi Aaron,

Hi Lance,


Thanks for the patch.

No problem.

Emm, I don't think we should do this :)

Removing the sysctl file is going to break userspace tools that
currently read it ...

Thank you for your feedback. I appreciate the concern regarding user-space
compatibility and the potential maintenance overhead of dual interfaces.

I agree that removing the sysctl entry entirely right now is too
disruptive, as it would immediately break existing user-space tools relying
on /proc/sys/kernel/hung_task_detect_count. Your point about avoiding
unnecessary churn and maintaining two interfaces is well-taken.

However, I believe that moving the counter to sysfs is still a worthwhile
long-term goal for the following reasons:

1. Consistency and standardisation: Moving read-only counters to
/sys/kernel/ aligns with current kernel conventions and provides a
more consistent location for performance and diagnostic metrics.
This follows the pattern of existing counters like
/sys/kernel/softlockup_count.

2. Graceful Migration Path: By adding the
/sys/kernel/hung_task_detect_count entry first (as a read-only
counter) and keeping the legacy
/proc/sys/kernel/hung_task_detect_count file in place, we provide
the necessary backwards compatibility and offer a grace period for
user-space tools to migrate. The old sysctl file can then be flagged
for deprecation in a future release.


Deprecating established sysctl ABIs is often a very long process(sometimes
indefinite) ... and I would prefer to avoid introducing redundancy unless
strictly necessary or the current interface is functionally deficient :)

So, it's a NACK from my side regarding the interface migration.

I am currently working on some additional updates for kernel/hung_task.c.

Please let's keep it simple and leave the interface as is. I look forward
to your other updates for hung_task.c!

[...]

Thanks,
Lance