From: Markus Metzger <markus.t.metzger@intel.com>
To: linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@linutronix.de,
hpa@zytor.com
Cc: markus.t.metzger@intel.com, markus.t.metzger@gmail.com,
roland@redhat.com, eranian@googlemail.com, oleg@redhat.com,
juan.villacis@intel.com, ak@linux.jf.intel.com
Subject: [patch] x86, bts: use atomic memory allocation
Date: Wed, 18 Mar 2009 19:27:00 +0100 [thread overview]
Message-ID: <20090318192700.A6038@sedona.ch.intel.com> (raw)
Ds_request_bts() needs to allocate memory. It uses GFP_KERNEL.
Hw-branch-tracer calls ds_request_bts() within on_each_cpu().
Use atomic memory allocation to allow it to be used in that context.
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
---
Index: git-tip/arch/x86/kernel/ds.c
===================================================================
--- git-tip.orig/arch/x86/kernel/ds.c 2009-03-17 12:26:07.000000000 +0100
+++ git-tip/arch/x86/kernel/ds.c 2009-03-17 13:30:09.000000000 +0100
@@ -255,8 +255,13 @@ static inline struct ds_context *ds_get_
struct ds_context *new_context = NULL;
unsigned long irq;
- /* Chances are small that we already have a context. */
- new_context = kzalloc(sizeof(*new_context), GFP_KERNEL);
+ /*
+ * Chances are small that we already have a context.
+ *
+ * Contexts for per-cpu tracing are allocated using
+ * smp_call_function(). We must not sleep.
+ */
+ new_context = kzalloc(sizeof(*new_context), GFP_ATOMIC);
if (!new_context)
return NULL;
@@ -662,8 +667,12 @@ struct bts_tracer *ds_request_bts(struct
if (ovfl)
goto out;
+ /*
+ * Per-cpu tracing is typically requested using smp_call_function().
+ * We must not sleep.
+ */
error = -ENOMEM;
- tracer = kzalloc(sizeof(*tracer), GFP_KERNEL);
+ tracer = kzalloc(sizeof(*tracer), GFP_ATOMIC);
if (!tracer)
goto out;
tracer->ovfl = ovfl;
@@ -722,8 +731,12 @@ struct pebs_tracer *ds_request_pebs(stru
if (ovfl)
goto out;
+ /*
+ * Per-cpu tracing is typically requested using smp_call_function().
+ * We must not sleep.
+ */
error = -ENOMEM;
- tracer = kzalloc(sizeof(*tracer), GFP_KERNEL);
+ tracer = kzalloc(sizeof(*tracer), GFP_ATOMIC);
if (!tracer)
goto out;
tracer->ovfl = ovfl;
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
next reply other threads:[~2009-03-18 18:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 18:27 Markus Metzger [this message]
2009-03-19 16:11 ` [patch] x86, bts: use atomic memory allocation Ingo Molnar
2009-03-20 8:07 ` Metzger, Markus T
2009-03-20 8:37 ` Andi Kleen
2009-03-20 16:23 ` Metzger, Markus T
2009-03-20 18:55 ` Ingo Molnar
2009-03-20 18:59 ` Markus Metzger
2009-03-25 9:07 ` Metzger, Markus T
2009-05-07 9:21 ` [tip:tracing/core] " tip-bot for Markus Metzger
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=20090318192700.A6038@sedona.ch.intel.com \
--to=markus.t.metzger@intel.com \
--cc=ak@linux.jf.intel.com \
--cc=eranian@googlemail.com \
--cc=hpa@zytor.com \
--cc=juan.villacis@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.t.metzger@gmail.com \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=roland@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