linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lockdep: Include all lock classes in all_lock_classes
@ 2008-02-01 15:21 Dale Farnsworth
  2008-02-03 15:21 ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Dale Farnsworth @ 2008-02-01 15:21 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel

Add each lock class to the all_lock_classes list when it is
first registered.

Previously, lock classes were added to all_lock_classes when
the lock class was first used.  Since one of the uses of the
list is to find unused locks, this didn't work well.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
 kernel/lockdep.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 723bd9f..e630127 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -779,6 +779,10 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
 	 * parallel walking of the hash-list safe:
 	 */
 	list_add_tail_rcu(&class->hash_entry, hash_head);
+	/*
+	 * Add it to the global list of classes:
+	 */
+	list_add_tail_rcu(&class->lock_entry, &all_lock_classes);
 
 	if (verbose(class)) {
 		graph_unlock();
@@ -2282,10 +2286,6 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
 			return 0;
 		break;
 	case LOCK_USED:
-		/*
-		 * Add it to the global list of classes:
-		 */
-		list_add_tail_rcu(&this->class->lock_entry, &all_lock_classes);
 		debug_atomic_dec(&nr_unused_locks);
 		break;
 	default:
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] lockdep: Include all lock classes in all_lock_classes
  2008-02-01 15:21 [PATCH] lockdep: Include all lock classes in all_lock_classes Dale Farnsworth
@ 2008-02-03 15:21 ` Peter Zijlstra
  2008-02-03 19:47   ` Dale Farnsworth
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2008-02-03 15:21 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: Ingo Molnar, linux-kernel


On Fri, 2008-02-01 at 08:21 -0700, Dale Farnsworth wrote:
> Add each lock class to the all_lock_classes list when it is
> first registered.
> 
> Previously, lock classes were added to all_lock_classes when
> the lock class was first used. 

> Since one of the uses of the list is to find unused locks, this didn't
> work well.

You mean in lockdep_proc.c to generate the statistics?

Another potential issue might be count_matching_names() generating a
wrong class version.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lockdep: Include all lock classes in all_lock_classes
  2008-02-03 15:21 ` Peter Zijlstra
@ 2008-02-03 19:47   ` Dale Farnsworth
  2008-02-03 19:57     ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Dale Farnsworth @ 2008-02-03 19:47 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, linux-kernel

On Sun, Feb 03, 2008 at 04:21:02PM +0100, Peter Zijlstra wrote:
> On Fri, 2008-02-01 at 08:21 -0700, Dale Farnsworth wrote:
> > Add each lock class to the all_lock_classes list when it is
> > first registered.
> > 
> > Previously, lock classes were added to all_lock_classes when
> > the lock class was first used. 
> 
> > Since one of the uses of the list is to find unused locks, this didn't
> > work well.
> 
> You mean in lockdep_proc.c to generate the statistics?

Yes, that's where I noticed it.  On my platform, there was one
unused lock which was missed.
> 
> Another potential issue might be count_matching_names() generating a
> wrong class version.

I haven't looked into that issue yet.

-Dale

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lockdep: Include all lock classes in all_lock_classes
  2008-02-03 19:47   ` Dale Farnsworth
@ 2008-02-03 19:57     ` Peter Zijlstra
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2008-02-03 19:57 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: Ingo Molnar, linux-kernel


On Sun, 2008-02-03 at 12:47 -0700, Dale Farnsworth wrote:
> On Sun, Feb 03, 2008 at 04:21:02PM +0100, Peter Zijlstra wrote:
> > On Fri, 2008-02-01 at 08:21 -0700, Dale Farnsworth wrote:
> > > Add each lock class to the all_lock_classes list when it is
> > > first registered.
> > > 
> > > Previously, lock classes were added to all_lock_classes when
> > > the lock class was first used. 
> > 
> > > Since one of the uses of the list is to find unused locks, this didn't
> > > work well.
> > 
> > You mean in lockdep_proc.c to generate the statistics?
> 
> Yes, that's where I noticed it.  On my platform, there was one
> unused lock which was missed.

OK, I'll clarify the description and take the patch. Thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-03 19:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-01 15:21 [PATCH] lockdep: Include all lock classes in all_lock_classes Dale Farnsworth
2008-02-03 15:21 ` Peter Zijlstra
2008-02-03 19:47   ` Dale Farnsworth
2008-02-03 19:57     ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).