From: Petr Mladek <pmladek@suse.com>
To: Lance Yang <lance.yang@linux.dev>
Cc: atomlin@atomlin.com, akpm@linux-foundation.org,
mhiramat@kernel.org, linux-kernel@vger.kernel.org,
david.laight.linux@gmail.com, neelx@suse.com, sean@ashe.io,
chjohnst@gmail.com, steve@abita.co, mproche@gmail.com,
nick.lange@gmail.com
Subject: Re: [PATCH v9 1/2] hung_task: Reset warning budget when problem gets resolved
Date: Fri, 28 Aug 2026 11:05:34 +0200 [thread overview]
Message-ID: <apFPXhPynOlfON4B@pathway.suse.cz> (raw)
In-Reply-To: <20260827153001.18515-1-lance.yang@linux.dev>
On Thu 2026-08-27 23:30:01, Lance Yang wrote:
> On Wed, Aug 26, 2026 at 01:17:47PM +0200, Petr Mladek wrote:
> >> @@ -314,6 +317,11 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
> >> if (test_taint(TAINT_DIE) || did_panic)
> >> return;
> >>
> >> + if (atomic_xchg(&reset_hung_task_warnings, 0))
> >
> >I would use here atomic_xchg_acquire(). It serializes the ordering
> >of reset_hung_task_warnings vs sysctl_hung_task_warnings.
> >It would make it symetric with the barrier in the sysctl handler.
>
> Yep, _acquire is enough here. Plain atomic_xchg() is already fully
> ordered, though, so this looks like making the intent clearer rather
> than fixing the ordering :)
Yes, my intention was to make the ordering more clear and symmetric.
The original code worked because the barrier was even stronger.
> The old-value return already makes plain atomic_xchg() fully ordered :)
>
> ORDERING (see memory-barriers.txt)
> --------
>
> The rule of thumb:
> ...
> - RMW operations that have a return value are fully ordered;
> ...
> Except of course when a successful operation has an explicit ordering
> like:
>
> {}_relaxed: unordered
> {}_acquire: the R of the RMW (or atomic_read) is an ACQUIRE
> {}_release: the W of the RMW (or atomic_set) is a RELEASE
>
> >
> >> + hung_task_warnings_printed =
> >> + READ_ONCE(sysctl_hung_task_warnings);
> >
> >This would work only when "sysctl_hung_task_warnings"
> >is updated using WRITE_ONCE(). But it seems that this
> >is not the case. My understading is that it is updated by:
>
> Wait, I think proc_dointvec_minmax() already handles this.
You are right.
> For proc_dointvec_minmax(), the converter is:
>
> int proc_dointvec_minmax(const struct ctl_table *table, int dir,
> void *buffer, size_t *lenp, loff_t *ppos)
> {
> return do_proc_dointvec(table, dir, buffer, lenp, ppos,
> do_proc_int_conv_minmax);
> }
>
> Here, i is table->data, while lval is local:
I have missed this.
> static int do_proc_dointvec(const struct ctl_table *table, int dir,
> void *buffer, size_t *lenp, loff_t *ppos,
> int (*conv)(bool *negp, unsigned long *u_ptr, int *k_ptr,
> int dir, const struct ctl_table *table))
> {
> ...
> i = (int *) table->data;
> vleft = table->maxlen / sizeof(*i);
> ...
> for (; left && vleft--; i++, first=0) {
> unsigned long lval;
> bool neg;
>
> if (SYSCTL_USER_TO_KERN(dir)) {
> proc_skip_spaces(&p, &left);
>
> if (!left)
> break;
> err = proc_get_long(&p, &left, &lval, &neg,
> proc_wspace_sep,
> sizeof(proc_wspace_sep), NULL);
I have missed that proc_get_long() assigns the value to the local
variable @lval.
> if (err)
> break;
> if (conv(&neg, &lval, i, 1, table)) {
> err = -EINVAL;
> break;
The real asigment to table->data is done here. And I agree that it
goes down to proc_int_conv() which does WRITE_ONCE().
So, we are on the safe side and do _not_ need the proxy table.
Now, I am not sure whether we need v10. It might be worth it.
AFAIK, Andrew has not taken this patchset yet...
I am sorry for complications.
Best Regards,
Petr
next prev parent reply other threads:[~2026-08-28 9:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 13:57 [PATCH v9 0/2] hung_task: Improve warning budget handling and task reporting Aaron Tomlin
2026-08-14 13:57 ` [PATCH v9 1/2] hung_task: Reset warning budget when problem gets resolved Aaron Tomlin
2026-08-14 15:58 ` Lance Yang
2026-08-14 17:22 ` Aaron Tomlin
2026-08-26 11:17 ` Petr Mladek
2026-08-27 15:30 ` Lance Yang
2026-08-28 9:05 ` Petr Mladek [this message]
2026-08-28 9:22 ` Lance Yang
2026-08-29 13:54 ` Aaron Tomlin
2026-08-14 13:57 ` [PATCH v9 2/2] hung_task: Log summary line when warning budget is exhausted Aaron Tomlin
2026-08-14 16:27 ` Lance Yang
2026-08-14 17:26 ` Aaron Tomlin
2026-08-26 11:31 ` Petr Mladek
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=apFPXhPynOlfON4B@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=atomlin@atomlin.com \
--cc=chjohnst@gmail.com \
--cc=david.laight.linux@gmail.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mproche@gmail.com \
--cc=neelx@suse.com \
--cc=nick.lange@gmail.com \
--cc=sean@ashe.io \
--cc=steve@abita.co \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.