From: tip-bot for Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, ananth@in.ibm.com, hpa@zytor.com,
mingo@redhat.com, jkenisto@us.ibm.com, tglx@linutronix.de,
mhiramat@redhat.com, mingo@elte.hu
Subject: [tip:tracing/core] kprobes: Sanitize struct kretprobe_instance allocations
Date: Mon, 2 Nov 2009 16:19:47 GMT [thread overview]
Message-ID: <tip-4dae560f97fa438f373b53e14b30149c9e44a600@git.kernel.org> (raw)
In-Reply-To: <20091030135310.GA22230@in.ibm.com>
Commit-ID: 4dae560f97fa438f373b53e14b30149c9e44a600
Gitweb: http://git.kernel.org/tip/4dae560f97fa438f373b53e14b30149c9e44a600
Author: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
AuthorDate: Fri, 30 Oct 2009 19:23:10 +0530
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 2 Nov 2009 17:00:18 +0100
kprobes: Sanitize struct kretprobe_instance allocations
For as long as kretprobes have existed, we've allocated NR_CPUS
instances of kretprobe_instance structures. With the default
value of CONFIG_NR_CPUS increasing on certain architectures, we
are potentially wasting kernel memory.
See http://sourceware.org/bugzilla/show_bug.cgi?id=10839#c3 for
more details.
Use a saner num_possible_cpus() instead of NR_CPUS for
allocation.
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: fweisbec@gmail.com
LKML-Reference: <20091030135310.GA22230@in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/kprobes.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 5240d75..1494e85 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1014,9 +1014,9 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
/* Pre-allocate memory for max kretprobe instances */
if (rp->maxactive <= 0) {
#ifdef CONFIG_PREEMPT
- rp->maxactive = max(10, 2 * NR_CPUS);
+ rp->maxactive = max(10, 2 * num_possible_cpus());
#else
- rp->maxactive = NR_CPUS;
+ rp->maxactive = num_possible_cpus();
#endif
}
spin_lock_init(&rp->lock);
prev parent reply other threads:[~2009-11-02 16:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-30 13:53 [PATCH] kprobes: Sanitize struct kretprobe_instance allocations Ananth N Mavinakayanahalli
2009-10-30 19:55 ` Masami Hiramatsu
2009-11-02 16:19 ` tip-bot for Ananth N Mavinakayanahalli [this message]
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=tip-4dae560f97fa438f373b53e14b30149c9e44a600@git.kernel.org \
--to=ananth@in.ibm.com \
--cc=hpa@zytor.com \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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