[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250408122939.84154-1-ioworker0@gmail.com>
Date: Tue, 8 Apr 2025 20:29:37 +0800
From: Lance Yang <ioworker0@...il.com>
To: akpm@...ux-foundation.org
Cc: amaindex@...look.com,
anna.schumaker@...cle.com,
boqun.feng@...il.com,
ioworker0@...il.com,
joel.granados@...nel.org,
jstultz@...gle.com,
kent.overstreet@...ux.dev,
leonylgao@...cent.com,
linux-kernel@...r.kernel.org,
longman@...hat.com,
mhiramat@...nel.org,
mingo@...hat.com,
mingzhe.yang@...com,
peterz@...radead.org,
rostedt@...dmis.org,
senozhatsky@...omium.org,
tfiga@...omium.org,
will@...nel.org
Subject: Re: [PATCH v4 1/3] hung_task: replace blocker_mutex with encoded blocker
On Tue, Apr 8, 2025 at 4:08 AM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> On Thu, 20 Mar 2025 14:49:21 +0800 Lance Yang <ioworker0@...il.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
Powered by blists - more mailing lists