linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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
Subject: Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries
Date: Wed, 29 Jun 2016 11:38:37 +0900	[thread overview]
Message-ID: <20160629023837.GD1628@sejong> (raw)
In-Reply-To: <20160628215738.6e4815dd@gandalf.local.home>

On Tue, Jun 28, 2016 at 09:57:38PM -0400, Steven Rostedt wrote:
> On Wed, 29 Jun 2016 10:32:34 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
> 
> > > is at 32-37
> > > 
> > > For a total of 38 bytes. I'm betting that without the packed, the 4
> > > extra bytes will always be at the end.  
> > 
> > Woundn't it be 36 or 40 bytes? :)
> 
> Ug, don't know what I was counting then. I added the 64 bit version as
> a after thought.
> 
> > 
> > > 
> > > If the compiler places it incorrectly without any attribute, it will
> > > fail to read the long long if the arch requires 64 bits to be 8 bytes
> > > aligned. The alignment is meaningless here. All we need is "packed" and
> > > be done with it. It's only going to truncate the 4 bytes at the end of
> > > the structure if that.  
> > 
> > I agree that in-struct alignment preserved without the 'aligned'
> > attribute but I'm not sure whether it's guaranteed that the *start*
> > address of the struct is still in proper alignment boundary.
> > 
> > IOW the struct ftrace_graph_ret should be placed at 8-byte boundary in order
> > to keep alignment of struct members.  Is it guaranteed after applying
> > 'packed'?
> > 
> 
> My point is, a structure doesn't change size depending on where it is
> located. Thus, if a structure contains a 8 byte field, that must be 8
> bytes aligned due to architecture constraints, then it had better be
> aligned that way everywhere. If it is not, then accessing the 8 byte
> fields will cause issues.
> 
> The only thing that the "packed" changes, is it removes the last 4
> padded bytes of the structure. It doesn't change anything else. Hence,
> the alignment is just extra and unneeded.

Ok then, I'll change it to use 'packed' only in v3.

Thanks,
Namhyung

  reply	other threads:[~2016-06-29  2:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28  5:30 [RFC/PATCH v2] ftrace: Reduce size of function graph entries Namhyung Kim
2016-06-28 23:32 ` Steven Rostedt
2016-06-28 23:32   ` Steven Rostedt
2016-06-29  1:32   ` Namhyung Kim
2016-06-29  1:57     ` Steven Rostedt
2016-06-29  2:38       ` Namhyung Kim [this message]
2016-06-29  3:22         ` 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=20160629023837.GD1628@sejong \
    --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;
as well as URLs for NNTP newsgroup(s).