From: Namhyung Kim <namhyung@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>
Subject: Re: [RFC/PATCH] ftrace: Reduce size of function graph entries
Date: Sat, 25 Jun 2016 01:15:34 +0900 [thread overview]
Message-ID: <20160624161534.GA29064@danjae.aot.lge.com> (raw)
In-Reply-To: <20160624120440.3961bb05@gandalf.local.home>
On Fri, Jun 24, 2016 at 12:04:40PM -0400, Steven Rostedt wrote:
> On Fri, 24 Jun 2016 15:35:44 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
>
>
> > > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> > > > index dea12a6e413b..35c523ba5c59 100644
> > > > --- a/include/linux/ftrace.h
> > > > +++ b/include/linux/ftrace.h
> > > > @@ -751,25 +751,33 @@ extern void ftrace_init(void);
> > > > static inline void ftrace_init(void) { }
> > > > #endif
> > > >
> > > > +#ifndef CONFIG_HAVE_64BIT_ALIGNED_ACCESS
> > > > +# define FTRACE_ALIGNMENT 4
> > > > +#else
> > > > +# define FTRACE_ALIGNMENT 8
> > > > +#endif
> > >
> > > Swap the above. Having the #ifndef is more confusing to understand than
> > > to have a #ifdef.
> >
> > Will do.
> >
> > >
> > > > +
> > > > +#define FTRACE_ALIGN_DATA __attribute__((packed, aligned(FTRACE_ALIGNMENT)))
> > >
> > > Do we really need to pack it? I mean, just get rid of the hole (like
> > > you did with the movement of the overrun) and shouldn't the array be
> > > aligned normally without holes, if the arch can support it? Doesn't gcc
> > > take care of that?
> >
> > I'm not sure I understood you correctly. AFAIK the size of struct is
> > a multiple of alignment unit and gcc manual says the aligment
> > attribute only can be increased unless the 'packed' is used as well..
>
> Ah, I see you are trying to get the recorded size in the array down to
> a 4 byte alignment (due to the "int depth"), instead of adding the 4
> bytes to the buffer.
>
> Hmm, I wondering if we need the ifdef above, as the ring buffer itself
> will force the 8 byte alignment of structures added to the buffer.
As far as I can see, the ring buffer has following code in ring_buffer.c:
#define RB_ALIGNMENT 4U
#define RB_MAX_SMALL_DATA (RB_ALIGNMENT * RINGBUF_TYPE_DATA_TYPE_LEN_MAX)
#define RB_EVNT_MIN_SIZE 8U /* two 32bit words */
#ifndef CONFIG_HAVE_64BIT_ALIGNED_ACCESS
# define RB_FORCE_8BYTE_ALIGNMENT 0
# define RB_ARCH_ALIGNMENT RB_ALIGNMENT
#else
# define RB_FORCE_8BYTE_ALIGNMENT 1
# define RB_ARCH_ALIGNMENT 8U
#endif
#define RB_ALIGN_DATA __aligned(RB_ARCH_ALIGNMENT)
Thanks,
Namhyung
next prev parent reply other threads:[~2016-06-24 16:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1463930775-12214-1-git-send-email-namhyung@kernel.org>
2016-06-23 13:37 ` [RFC/PATCH] ftrace: Reduce size of function graph entries Steven Rostedt
2016-06-23 13:37 ` Steven Rostedt
2016-06-24 6:35 ` Namhyung Kim
2016-06-24 16:04 ` Steven Rostedt
2016-06-24 16:15 ` Namhyung Kim [this message]
2016-06-24 17:29 ` Steven Rostedt
2016-06-24 17:29 ` Steven Rostedt
2016-06-25 3:44 ` Namhyung Kim
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=20160624161534.GA29064@danjae.aot.lge.com \
--to=namhyung@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
/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