mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com,
	lizf@cn.fujitsu.com, peterz@infradead.org, fweisbec@gmail.com,
	tglx@linutronix.de, jbaron@redhat.com, mhiramat@redhat.com,
	mingo@elte.hu
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:tracing/urgent] tracing: Allocate the ftrace event profile buffer dynamically
Date: Sat, 19 Sep 2009 09:45:14 -0400	[thread overview]
Message-ID: <1253367914.20020.338.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <tip-31dcbc09033bd90190e90d943863d7ef9f39b93b@git.kernel.org>

On Sat, 2009-09-19 at 07:58 +0000, tip-bot for Frederic Weisbecker
wrote:

> +/*
> + * We can't use a size but a type in alloc_percpu()
> + * So let's create a dummy type that matches the desired size
> + */
> +typedef struct {char buf[FTRACE_MAX_PROFILE_SIZE];} profile_buf_t;
> +
>  static int ftrace_profile_enable_event(struct ftrace_event_call *event)
>  {
> +	char *buf;
> +	int ret;
> +
>  	if (atomic_inc_return(&event->profile_count))
>  		return 0;
>  
> -	return event->profile_enable();
> +	buf = (char *)alloc_percpu(profile_buf_t);
> +	if (!buf)
> +		return -ENOMEM;

Ingo,

Did you pull in the version that allocates a buffer for each event? I
thought Frederic made just a global per cpu buffer that all events can
use. The buffer is just a temporary storage that will be too big to put
on the stack.

-- Steve

> +
> +	rcu_assign_pointer(event->profile_buf, buf);
> +
> +	buf = (char *)alloc_percpu(profile_buf_t);
> +	if (!buf) {
> +		ret = -ENOMEM;
> +		goto fail_nmi;
> +	}
> +
> +	rcu_assign_pointer(event->profile_buf_nmi, buf);
> +
> +	ret = event->profile_enable();
> +	if (!ret)
> +		return 0;
> +
> +	kfree(event->profile_buf_nmi);
> +fail_nmi:
> +	kfree(event->profile_buf);
> +
> +	return ret;
>  }
>  


       reply	other threads:[~2009-09-19 13:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-31dcbc09033bd90190e90d943863d7ef9f39b93b@git.kernel.org>
2009-09-19 13:45 ` Steven Rostedt [this message]
2009-09-19 16:52   ` Ingo Molnar
     [not found] <tip-20ab4425a77a1f34028cc6ce57053c22c184ba5f@git.kernel.org>
2009-09-19 13:47 ` Steven Rostedt

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=1253367914.20020.338.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --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

all inboxes | Powered by JetHome®