Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433402

Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries
Date 2016-06-29 04:00 +0200
Message-ID <rPcXf-6eR-1@gated-at.bofh.it> (permalink)
References <rOTUC-2AT-13@gated-at.bofh.it> <rPaLM-516-3@gated-at.bofh.it> <rPcDT-68s-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

-- Steve

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC/PATCH v2] ftrace: Reduce size of function graph entries Namhyung Kim <namhyung@kernel.org> - 2016-06-28 07:40 +0200
  Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries Steven Rostedt <rostedt@goodmis.org> - 2016-06-29 01:40 +0200
    Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries Namhyung Kim <namhyung@kernel.org> - 2016-06-29 03:40 +0200
      Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries Steven Rostedt <rostedt@goodmis.org> - 2016-06-29 04:00 +0200
        Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries Namhyung Kim <namhyung@kernel.org> - 2016-06-29 04:40 +0200
          Re: [RFC/PATCH v2] ftrace: Reduce size of function graph entries Steven Rostedt <rostedt@goodmis.org> - 2016-06-29 05:30 +0200

csiph-web