public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>, Joerg Roedel <joerg.roedel@amd.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: bug in tty ldisc and friends
Date: Tue, 16 Jun 2009 12:36:06 +0200	[thread overview]
Message-ID: <20090616103606.GA3497@elte.hu> (raw)
In-Reply-To: <20090616102910.GA11011@elte.hu>


* Ingo Molnar <mingo@elte.hu> wrote:

> This is something we noticed recently: dma-debug uses a lot of 
> lock classes and thus creates a really large lock-graph, depleting 
> the reserves quickly.

yep, i think dma-debug is the culprit. It has:

 #define HASH_SIZE       1024ULL

each hash entry has a separate lock.

But this should be easily to solve: a special lock-class for these 
locks. Patch below (warning: utterly untested!).

(Btw., that SPIN_LOCK_UNLOCKED init method should really be 
deprecated for real.)

	Ingo

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 3b93129..012c240 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -62,6 +62,8 @@ struct dma_debug_entry {
 #endif
 };
 
+static struct lock_class_key hash_bucket_class;
+
 struct hash_bucket {
 	struct list_head list;
 	spinlock_t lock;
@@ -716,7 +718,8 @@ void dma_debug_init(u32 num_entries)
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
-		dma_entry_hash[i].lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&dma_entry_hash[i].lock);
+		lockdep_set_lock_class(&dma_entry_hash[i].lock, &hash_bucket_class);
 	}
 
 	if (dma_debug_fs_init() != 0) {

  parent reply	other threads:[~2009-06-16 10:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16  5:45 bug in tty ldisc and friends Steven Rostedt
2009-06-16  8:37 ` Alan Cox
2009-06-16  8:50   ` Ingo Molnar
2009-06-16  8:57     ` Alan Cox
2009-06-16  9:09       ` Ingo Molnar
2009-06-16 10:00       ` Ingo Molnar
2009-06-16 10:04         ` Alan Cox
2009-06-16 10:12           ` Ingo Molnar
2009-06-16 10:25             ` Ingo Molnar
2009-06-16 10:29               ` Ingo Molnar
2009-06-16 10:34                 ` Joerg Roedel
2009-06-16 10:45                   ` Ingo Molnar
2009-06-16 10:36                 ` Ingo Molnar [this message]
2009-06-16 11:39                   ` Joerg Roedel
2009-06-16 12:11                     ` Ingo Molnar
2009-06-16 15:24                   ` Joerg Roedel
2009-06-17  8:32                   ` Peter Zijlstra
2009-06-17 14:10                     ` Ingo Molnar
2009-06-17 14:28                       ` Joerg Roedel

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=20090616103606.GA3497@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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