From: Ingo Molnar <mingo@elte.hu>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org
Subject: Re: [RESEND PATCH 01/11] kernel:lockdep:print the shortest dependency chain if finding a circle
Date: Mon, 13 Jul 2009 09:01:10 +0200 [thread overview]
Message-ID: <20090713070110.GA28499@elte.hu> (raw)
In-Reply-To: <d82e647a0907111942o1cf22batb204c38bfbd43c03@mail.gmail.com>
* Ming Lei <tom.leiming@gmail.com> wrote:
> > If I understand well, lets imagine the following:
> >
> > Task 1 acquires: A B F
> > Task 2 acquires: A B C D E F
> > Task 3 acquires: F B
> >
> > Before your patch, DFS would report the BF - FB wicked
> > dependency by reporting the Task 2 dependency snapshot, which is
> > cluttered by the other locks C, D and E (that would be reported
> > in the dependency chain if I'm not wrong) whereas BFS would be
> > smarter by finding the shortest snapshot found in Task 3: just F
> > B.
> >
> > Correct me if I misunderstand this patch.
>
> You are correct, BFS will always find the shortest circle if there
> is circle.
>
> > I suggest you to provide an example along this patch, that would
> > make it easier to demonstrate its importance.
>
> No, as you said, the shortest circle is not very important, and it
> is just a byproduct and we have no reason to reject it.
It's a nice byproduct, beyond the primary advantage of not being a
stack based recursion check.
I think this patch-set is great, and there's just one more step
needed to make it round: it would be nice to remove the limitation
of maximum number of locks held per task. (MAX_LOCK_DEPTH)
The way we could do it is to split out this bit of struct task:
#ifdef CONFIG_LOCKDEP
# define MAX_LOCK_DEPTH 48UL
u64 curr_chain_key;
int lockdep_depth;
unsigned int lockdep_recursion;
struct held_lock held_locks[MAX_LOCK_DEPTH];
gfp_t lockdep_reclaim_gfp;
#endif
into a separate 'struct lockdep_state' structure, and allocate it
dynamically during fork with a initial pre-set size of say 64 locks
depth. If we hit that limit, we'd double the allocation threshold,
which would cause a larger structure to be allocated for all newly
allocated tasks.
( This means that the task that hits this threshold needs to have
lockdep disabled until it exits - but that's OK. )
Ingo
next prev parent reply other threads:[~2009-07-13 7:01 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-28 15:04 [RESEND PATCH 0/11] kernel:lockdep:replace DFS with BFS tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 01/11] kernel:lockdep:print the shortest dependency chain if finding a circle tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 02/11] kernel:lockdep:improve implementation of BFS tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 03/11] kernel:lockdep: introduce match function to BFS tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 04/11] kernel:lockdep:implement check_noncircular() by BFS tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 05/11] kernel:lockdep:implement find_usage_*wards " tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 06/11] kernel:lockdep:introduce print_shortest_lock_dependencies tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 07/11] kernel:lockdep: implement lockdep_count_*ward_deps by BFS tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 08/11] kernel:lockdep: update memory usage introduced " tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 09/11] kernel:lockdep:add statistics info for max bfs queue depth tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 10/11] BFS cleanup tom.leiming
2009-06-28 15:04 ` [RESEND PATCH 11/11] kernel:lockdep:fix return value of check_usage*() tom.leiming
2009-07-18 14:24 ` [tip:core/locking] lockdep: BFS cleanup tip-bot for Peter Zijlstra
2009-07-18 17:23 ` Peter Zijlstra
2009-08-02 13:03 ` tip-bot for Peter Zijlstra
2009-07-18 14:24 ` [tip:core/locking] lockdep: Add statistics info for max bfs queue depth tip-bot for Ming Lei
2009-08-02 13:03 ` tip-bot for Ming Lei
2009-07-18 14:24 ` [tip:core/locking] lockdep: Update memory usage introduced by BFS tip-bot for Ming Lei
2009-07-18 17:23 ` Peter Zijlstra
2009-08-02 13:02 ` tip-bot for Ming Lei
2009-07-18 14:24 ` [tip:core/locking] lockdep: Implement lockdep_count_*ward_deps " tip-bot for Ming Lei
2009-08-02 13:02 ` tip-bot for Ming Lei
2009-07-18 14:24 ` [tip:core/locking] lockdep: Introduce print_shortest_lock_dependencies tip-bot for Ming Lei
2009-08-02 13:02 ` tip-bot for Ming Lei
2009-07-18 14:23 ` [tip:core/locking] lockdep: Implement find_usage_*wards by BFS tip-bot for Ming Lei
2009-08-02 13:02 ` tip-bot for Ming Lei
2009-07-13 8:02 ` [RESEND PATCH 04/11] kernel:lockdep:implement check_noncircular() " Dave Young
2009-07-13 8:08 ` Dave Young
2009-07-21 3:33 ` Ming Lei
2009-07-18 14:23 ` [tip:core/locking] lockdep: Implement " tip-bot for Ming Lei
2009-08-02 13:02 ` tip-bot for Ming Lei
2009-07-18 14:23 ` [tip:core/locking] lockdep: Introduce match function to BFS tip-bot for Ming Lei
2009-08-02 13:01 ` tip-bot for Ming Lei
2009-07-18 14:23 ` [tip:core/locking] lockdep: Improve implementation of BFS tip-bot for Ming Lei
2009-08-02 13:01 ` tip-bot for Ming Lei
2009-07-11 21:30 ` [RESEND PATCH 01/11] kernel:lockdep:print the shortest dependency chain if finding a circle Frederic Weisbecker
2009-07-12 2:42 ` Ming Lei
2009-07-13 7:01 ` Ingo Molnar [this message]
2009-07-13 9:14 ` Peter Zijlstra
2009-07-13 13:56 ` Ming Lei
2009-07-13 13:51 ` Ming Lei
2009-07-13 9:01 ` Dave Young
2009-07-18 14:23 ` [tip:core/locking] lockdep: Print " tip-bot for Ming Lei
2009-08-02 13:01 ` tip-bot for Ming Lei
2009-07-11 0:43 ` [RESEND PATCH 0/11] kernel:lockdep:replace DFS with BFS Frederic Weisbecker
2009-07-11 3:25 ` Ming Lei
2009-07-11 21:09 ` Frederic Weisbecker
2009-07-12 2:29 ` Ming Lei
2009-07-13 7:02 ` Ingo Molnar
2009-07-13 9:16 ` Peter Zijlstra
2009-07-16 4:39 ` Ming Lei
2009-07-16 5:22 ` Peter Zijlstra
2009-07-16 7:12 ` Ming Lei
2009-07-16 9:54 ` Peter Zijlstra
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=20090713070110.GA28499@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tom.leiming@gmail.com \
/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