linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Yong Zhang <yong.zhang@windriver.com>
Cc: John Kacur <jkacur@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>,
	Sven-Thorsten Dietrich <thebigcorporation@gmail.com>,
	Clark Williams <williams@redhat.com>,
	"Luis Claudio R. Goncalves" <lgoncalv@redhat.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Gregory Haskins <ghaskins@novell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Yong Zhang <yong.zhang0@gmail.com>
Subject: Re: [PATCH V2] lockdep: reduce stack_trace usage
Date: Tue, 04 May 2010 14:56:51 +0200	[thread overview]
Message-ID: <1272977811.5605.183.camel@twins> (raw)
In-Reply-To: <20100504065711.GC10784@windriver.com>

On Tue, 2010-05-04 at 14:57 +0800, Yong Zhang wrote:
> From 04395389820e89c0bd4bb57b939ec1882e0bb5da Mon Sep 17 00:00:00 2001
> From: Yong Zhang <yong.zhang@windriver.com>
> Date: Tue, 4 May 2010 14:16:48 +0800
> Subject: [PATCH] lockdep: Reduce stack_trace usage
> 
> When calling check_prevs_add(), if all validations passed
> add_lock_to_list() will add new lock to dependency tree and
> alloc stack_trace for each list_entry. But at this time,
> we are always on the same stack, so stack_trace for each
> list_entry has the same value. This is redundant and eats up
> lots of memory which could lead to warning on low
> MAX_STACK_TRACE_ENTRIES.
> Using one copy of stack_trace instead.

Right, this looks like it ought to do as intended.

I added the below snipped because I know I'll fail to remember and that
'static' qualifier is fairly easy to miss.

Thanks!

---

Index: linux-2.6/kernel/lockdep.c
===================================================================
--- linux-2.6.orig/kernel/lockdep.c
+++ linux-2.6/kernel/lockdep.c
@@ -1627,6 +1627,13 @@ check_prev_add(struct task_struct *curr,
 	int ret;
 	struct lock_list this;
 	struct lock_list *uninitialized_var(target_entry);
+	/*
+	 * Static variable, serialized by the graph_lock().
+	 *
+	 * We use this static variable to save the stack trace in case
+	 * we call into this function multiple times due to encountering
+	 * trylocks in the held lock stack.
+	 */
 	static struct stack_trace trace;
 
 	/*

  reply	other threads:[~2010-05-04 12:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 20:15 [PATCH] lockdep: Add nr_save_trace_invocations counter John Kacur
2010-04-23  2:58 ` Yong Zhang
2010-04-23  6:52   ` Peter Zijlstra
2010-04-23  8:03     ` Yong Zhang
2010-04-23  7:24   ` John Kacur
2010-04-23  8:00     ` Yong Zhang
2010-04-23  8:05     ` Peter Zijlstra
2010-04-23  8:31       ` John Kacur
2010-04-23  8:49         ` Yong Zhang
2010-04-23  9:40           ` John Kacur
2010-04-23 13:40         ` [PATCH] lockdep: reduce stack_trace usage Yong Zhang
2010-04-26  6:24           ` Yong Zhang
2010-05-03 12:11           ` Peter Zijlstra
2010-05-04  6:37             ` Yong Zhang
2010-05-04  6:57           ` [PATCH V2] " Yong Zhang
2010-05-04 12:56             ` Peter Zijlstra [this message]
2010-05-05  1:31               ` Yong Zhang
2010-05-05  9:09                 ` Peter Zijlstra
2010-05-05  9:18                   ` Yong Zhang

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=1272977811.5605.183.camel@twins \
    --to=peterz@infradead.org \
    --cc=davem@davemloft.net \
    --cc=ghaskins@novell.com \
    --cc=jkacur@redhat.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=thebigcorporation@gmail.com \
    --cc=williams@redhat.com \
    --cc=yong.zhang0@gmail.com \
    --cc=yong.zhang@windriver.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;
as well as URLs for NNTP newsgroup(s).