linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	srostedt@redhat.com, tglx@linutronix.de, laijs@cn.fujitsu.com,
	mingo@elte.hu
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:tracing/ftrace] ftrace: remove struct list_head from struct dyn_ftrace
Date: Mon, 16 Mar 2009 13:42:30 +0100	[thread overview]
Message-ID: <20090316124229.GB5096@nowhere> (raw)
In-Reply-To: <20090316123607.GA5096@nowhere>

On Mon, Mar 16, 2009 at 01:36:09PM +0100, Frederic Weisbecker wrote:
> On Fri, Mar 13, 2009 at 10:39:36AM +0000, Lai Jiangshan wrote:
> > Commit-ID:  e94142a67f8bad494c593f0a07c9fc2fbec98c0e
> > Gitweb:     http://git.kernel.org/tip/e94142a67f8bad494c593f0a07c9fc2fbec98c0e
> > Author:     Lai Jiangshan <laijs@cn.fujitsu.com>
> > AuthorDate: Fri, 13 Mar 2009 17:51:27 +0800
> > Commit:     Ingo Molnar <mingo@elte.hu>
> > CommitDate: Fri, 13 Mar 2009 11:36:20 +0100
> > 
> > ftrace: remove struct list_head from struct dyn_ftrace
> > 
> > Impact: save memory
> > 
> > The struct dyn_ftrace table is very large, this patch will save
> > about 50%.
> > 
> > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > Cc: Steven Rostedt <srostedt@redhat.com>
> > LKML-Reference: <49BA2C9F.8020009@cn.fujitsu.com>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > 
> > ---
> >  include/linux/ftrace.h |    1 -
> >  kernel/trace/ftrace.c  |   14 ++++++++------
> >  2 files changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> > index c146c10..9d598bb 100644
> > --- a/include/linux/ftrace.h
> > +++ b/include/linux/ftrace.h
> > @@ -145,7 +145,6 @@ enum {
> >  };
> >  
> >  struct dyn_ftrace {
> > -	struct list_head	list;
> >  	unsigned long		ip; /* address of mcount call-site */
> >  	unsigned long		flags;
> >  	struct dyn_arch_ftrace	arch;
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index bf78a4c..90d5729 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -272,7 +272,7 @@ enum {
> >  
> >  static int ftrace_filtered;
> >  
> > -static LIST_HEAD(ftrace_new_addrs);
> > +static struct dyn_ftrace *ftrace_new_addrs;
> >  
> >  static DEFINE_MUTEX(ftrace_regex_lock);
> >  
> > @@ -409,8 +409,8 @@ ftrace_record_ip(unsigned long ip)
> >  		return NULL;
> >  
> >  	rec->ip = ip;
> > -
> > -	list_add(&rec->list, &ftrace_new_addrs);
> > +	rec->flags = (unsigned long)ftrace_new_addrs;
> > +	ftrace_new_addrs = rec;
> 
> 
> But... you are overwritting all the ftrace flags infrastructure by
> using it as a list pointer.
> 
> This is breaking dynamic tracing.


May be I'm wrong. May be I misunderstood this patch.
But I don't understand how flags can be used at the same time as a pointer
and as a flag value.

 
> >  
> >  	return rec;
> >  }
> > @@ -716,19 +716,21 @@ unsigned long		ftrace_update_tot_cnt;
> >  
> >  static int ftrace_update_code(struct module *mod)
> >  {
> > -	struct dyn_ftrace *p, *t;
> > +	struct dyn_ftrace *p;
> >  	cycle_t start, stop;
> >  
> >  	start = ftrace_now(raw_smp_processor_id());
> >  	ftrace_update_cnt = 0;
> >  
> > -	list_for_each_entry_safe(p, t, &ftrace_new_addrs, list) {
> > +	while (ftrace_new_addrs) {
> >  
> >  		/* If something went wrong, bail without enabling anything */
> >  		if (unlikely(ftrace_disabled))
> >  			return -1;
> >  
> > -		list_del_init(&p->list);
> > +		p = ftrace_new_addrs;
> > +		ftrace_new_addrs = (struct dyn_ftrace *)p->flags;
> > +		p->flags = 0L;
> >  
> >  		/* convert record (i.e, patch mcount-call with NOP) */
> >  		if (ftrace_code_disable(mod, p)) {
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2009-03-16 12:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13  9:51 [PATCH] ftace: remove struct list_head in struct dyn_ftrace Lai Jiangshan
2009-03-13 10:39 ` [tip:tracing/ftrace] ftrace: remove struct list_head from " Lai Jiangshan
2009-03-13 13:16   ` Steven Rostedt
2009-03-16 12:36   ` Frederic Weisbecker
2009-03-16 12:42     ` Frederic Weisbecker [this message]
2009-03-18  2:50       ` Lai Jiangshan

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=20090316124229.GB5096@nowhere \
    --to=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=srostedt@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;
as well as URLs for NNTP newsgroup(s).