From: Lance Yang <ioworker0@gmail.com>
To: akpm@linux-foundation.org
Cc: amaindex@outlook.com, anna.schumaker@oracle.com,
boqun.feng@gmail.com, ioworker0@gmail.com,
joel.granados@kernel.org, jstultz@google.com,
kent.overstreet@linux.dev, leonylgao@tencent.com,
linux-kernel@vger.kernel.org, longman@redhat.com,
mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com,
peterz@infradead.org, rostedt@goodmis.org,
senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org
Subject: Re: [PATCH v4 1/3] hung_task: replace blocker_mutex with encoded blocker
Date: Tue, 8 Apr 2025 20:29:37 +0800 [thread overview]
Message-ID: <20250408122939.84154-1-ioworker0@gmail.com> (raw)
In-Reply-To: <20250407130825.69b4c879b242df4caaf426cf@linux-foundation.org>
On Tue, Apr 8, 2025 at 4:08 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Thu, 20 Mar 2025 14:49:21 +0800 Lance Yang <ioworker0@gmail.com> wrote:
>
> > This patch replaces 'struct mutex *blocker_mutex' with 'unsigned long
> > blocker', as only one blocker is active at a time.
> >
> > The blocker filed can store both the lock addrees and the lock type, with
> > LSB used to encode the type as Masami suggested, making it easier to extend
> > the feature to cover other types of locks.
> >
> > Also, once the lock type is determined, we can directly extract the address
> > and cast it to a lock pointer ;)
> >
> > ...
> >
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -1218,7 +1218,7 @@ struct task_struct {
> > #endif
> >
> > #ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
> > - struct mutex *blocker_mutex;
> > + unsigned long blocker;
>
> -ENOCOMMENT
>
Got it. Does the following change make sense and is it clear?
diff --git a/include/linux/sched.h b/include/linux/sched.h
index f27060dac499..27dad9aa99a0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1218,6 +1218,10 @@ struct task_struct {
#endif
#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
+ /*
+ * Encoded lock address causing task block (lower 2 bits = type from
+ * <linux/hung_task.h>). Accessed via hung_task_*() helpers.
+ */
unsigned long blocker;
#endif
---
Thanks,
Lance
next prev parent reply other threads:[~2025-04-08 12:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 6:49 [PATCH v4 0/3] hung_task: extend blocking task stacktrace dump to semaphore Lance Yang
2025-03-20 6:49 ` [PATCH v4 1/3] hung_task: replace blocker_mutex with encoded blocker Lance Yang
2025-04-07 20:08 ` Andrew Morton
2025-04-08 12:29 ` Lance Yang [this message]
2025-03-20 6:49 ` [PATCH v4 2/3] hung_task: show the blocker task if the task is hung on semaphore Lance Yang
2025-04-07 20:08 ` Andrew Morton
2025-04-07 20:08 ` Andrew Morton
2025-04-08 12:27 ` Lance Yang
2025-03-20 6:49 ` [PATCH v4 3/3] samples: extend hung_task detector test with semaphore support Lance Yang
2025-04-07 20:08 ` [PATCH v4 0/3] hung_task: extend blocking task stacktrace dump to semaphore Andrew Morton
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=20250408122939.84154-1-ioworker0@gmail.com \
--to=ioworker0@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=amaindex@outlook.com \
--cc=anna.schumaker@oracle.com \
--cc=boqun.feng@gmail.com \
--cc=joel.granados@kernel.org \
--cc=jstultz@google.com \
--cc=kent.overstreet@linux.dev \
--cc=leonylgao@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=mingzhe.yang@ly.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tfiga@chromium.org \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®