From: Waiman Long <longman@redhat.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v2 (repost)] locking/lockdep: add debug_show_all_lock_holders()
Date: Mon, 16 Jan 2023 22:28:01 -0500 [thread overview]
Message-ID: <8cfce359-2b55-5158-3a7f-d83a7be212f4@redhat.com> (raw)
In-Reply-To: <e68b4c88-a278-90d0-0ce0-9d4e161366cc@I-love.SAKURA.ne.jp>
On 1/14/23 04:53, Tetsuo Handa wrote:
> On 2023/01/14 18:36, Ingo Molnar wrote:
>> Yeah, so note how you introduce a function with a parameter:
>>
>> void __debug_show_all_locks(bool show_stack)
>>
>> ... only to then *hide* the new parameter via helper functions:
>>
>> static inline void debug_show_all_locks(void)
>> {
>> __debug_show_all_locks(false);
>> }
>>
>> static inline void debug_show_all_lock_holders(void)
>> {
>> __debug_show_all_locks(true);
>> }
>>
>> ... which is a *strong* hint by our universe that the new parameter was
>> probably a bad idea to begin with.
>>
>> Given how small debug_show_all_locks() is to begin with, I'd suggest simply
>> duplicating the loop into debug_show_all_lock_holders() or so.
> Initial version at https://lkml.kernel.org/r/82af40cc-bf85-2b53-b8f9-dfc12e66a781@I-love.SAKURA.ne.jp
> was duplicating the loop.
>
> Waiman Long suggested me not to duplicate the loop at
> https://lkml.kernel.org/r/3e027453-fda4-3891-3ec3-5623f1525e56@redhat.com .
>
> Please talk with Waiman. I'm fine with either approach.
My original concern was that two functions are very similar with some
minor difference. My suggestion was to use a common helper to reduce the
code redundancy and future maintenance.
I do have some nits about the patch. The show_stack parameter isn't
informative. Maybe you can use show_tasks as the parameter name since
the major difference is the calling of sched_show_task().
Define a new helper like debug_show_all_locks_tasks(bool show_tasks),
use it directly in check_hung_uninterruptible_tasks() and make
debug_show_all_lock() call debug_show_all_locks_tasks().
Ingo, will that OK with you?
Cheers,
Longman
next prev parent reply other threads:[~2023-01-17 3:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 10:10 Tetsuo Handa
2022-12-29 0:25 ` Tetsuo Handa
2023-01-07 12:58 ` Tetsuo Handa
2023-01-14 9:36 ` Ingo Molnar
2023-01-14 9:53 ` Tetsuo Handa
2023-01-17 3:28 ` Waiman Long [this message]
2023-01-31 9:52 ` Tetsuo Handa
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=8cfce359-2b55-5158-3a7f-d83a7be212f4@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.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®