mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Lance Yang <lance.yang@linux.dev>
Cc: Aaron Tomlin <atomlin@atomlin.com>,
	sean@ashe.io, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, akpm@linux-foundation.org,
	joel.granados@kernel.org, mhiramat@kernel.org
Subject: Re: [v6 PATCH 0/2] hung_task: Provide runtime reset interface for hung task detector
Date: Tue, 20 Jan 2026 10:46:14 +0100	[thread overview]
Message-ID: <aW9O5ocB1XdzVgr0@pathway.suse.cz> (raw)
In-Reply-To: <0b4a76d3-9dcc-450c-9902-dc37b84eb2cb@linux.dev>

On Fri 2026-01-16 10:22:34, Lance Yang wrote:
> 
> 
> On 2026/1/16 02:18, Aaron Tomlin wrote:
> > On Thu, Jan 15, 2026 at 11:24:13AM +0800, Lance Yang wrote:
> > > IIUC, we should just do:
> > > - Patch 1: Full cmpxchg-based counting (Petr's POC), sysctl read-only
> > > - Patch 2: Add write handler for userspace reset
> > > 
> > > That way Patch 1 is the real logic change, and Patch 2 is just adding
> > > the userspace interface.
> > 
> > Hi Lance,
> > 
> > Thank you for your feedback.
> > If I am not mistaken, Joel suggested the following structure [1]:
> > 
> >      1. Create a preparatory patch to change the data type to atomic_long_t
> >      2. Introduce the required functionality to support a reset to "0"
> > 
> > [1]: https://lore.kernel.org/lkml/d4vx6k7d4tlagesq55yrbma26i2nyt4tpijkme6ckioeyfqfec@txrs27niaj2m/
> > 
> 
> Yeah, either way works :)
> 
> But that way (changing to atomic with the old logic first, then
> rewriting to the new logic) seems like it creates more churn
> and makes review harder.

I agree that adding the atomic and keeping the old logic is not
good. I would prefer to split it into two patches the following
way:

  1. Reshufle the code so that "sysctl_hung_task_detect_count"
     gets incremented in check_hung_uninterruptible_tasks()
     and hung_task_info() will just get "this_round_count".

     Plus convert "sysctl_hung_task_detect_count" to atomic.

     It is the change that I suggested at
     https://lore.kernel.org/lkml/aWTzhLSWQRIGt8Xu@pathway.suse.cz/

     This way, it would be clear why the reshufling was done.
     And the atomic operations will get the right acquire/release
     semantic right away.


   2. Add support to reset the couter to "0".

      It should be a quite simple patch easy to review.


I think that this is how Joel meant it. We could even have 3 patches:

   1. Move "sysctl_hung_task_detect_count" increment to
      check_hung_uninterruptible_tasks().

   2. Convert the counter to atomic operations.

   3. Add reset to "0" support.

But I think that two patches might be good enough.

Best Regards,
Petr

  reply	other threads:[~2026-01-20  9:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15  2:32 Aaron Tomlin
2026-01-15  2:32 ` [v6 PATCH 1/2] hung_task: Convert detection count to atomic_long_t Aaron Tomlin
2026-01-15  2:32 ` [v6 PATCH 2/2] hung_task: Enable runtime reset of hung_task_detect_count Aaron Tomlin
2026-01-15  3:06   ` Lance Yang
2026-01-15 18:24     ` Aaron Tomlin
2026-01-16  2:10       ` Lance Yang
2026-01-15  3:24 ` [v6 PATCH 0/2] hung_task: Provide runtime reset interface for hung task detector Lance Yang
2026-01-15 18:18   ` Aaron Tomlin
2026-01-16  2:22     ` Lance Yang
2026-01-20  9:46       ` Petr Mladek [this message]
2026-01-20 11:48         ` Lance Yang
2026-01-23  0:59         ` Aaron Tomlin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aW9O5ocB1XdzVgr0@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=atomlin@atomlin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel.granados@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=sean@ashe.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome