[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250414143637.a1ae89d6b46c13f195e9210e@linux-foundation.org>
Date: Mon, 14 Apr 2025 14:36:37 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Lance Yang <ioworker0@...il.com>
Cc: will@...nel.org, peterz@...radead.org, mingo@...hat.com,
longman@...hat.com, mhiramat@...nel.org, anna.schumaker@...cle.com,
boqun.feng@...il.com, joel.granados@...nel.org, kent.overstreet@...ux.dev,
leonylgao@...cent.com, linux-kernel@...r.kernel.org, rostedt@...dmis.org,
senozhatsky@...omium.org, tfiga@...omium.org, amaindex@...look.com,
jstultz@...gle.com, Mingzhe Yang <mingzhe.yang@...com>
Subject: Re: [PATCH v5 1/3] hung_task: replace blocker_mutex with encoded
blocker
On Mon, 14 Apr 2025 22:59:43 +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 ;)
>
> ...
>
> static void debug_show_blocker(struct task_struct *task)
> {
> struct task_struct *g, *t;
> - unsigned long owner;
> - struct mutex *lock;
> + unsigned long owner, blocker;
>
> RCU_LOCKDEP_WARN(!rcu_read_lock_held(), "No rcu lock held");
>
> - lock = READ_ONCE(task->blocker_mutex);
> - if (!lock)
> + blocker = READ_ONCE(task->blocker);
> + if (!blocker ||
> + hung_task_get_blocker_type(blocker) != BLOCKER_TYPE_MUTEX)
> return;
>
> - owner = mutex_get_owner(lock);
> + owner = mutex_get_owner(
> + (struct mutex *)hung_task_blocker_to_lock(blocker));
typecast is unneeded?
Powered by blists - more mailing lists