diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-02-09 17:04:06 -0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-11 13:21:40 +0100 |
commit | 00f62f614bb713027b9296068d1879fbca511eb7 (patch) | |
tree | 682f45c89a43c4bbde751b75764dd62e8fe09c7e /mm | |
parent | d524e03207591a6de7e6b5069aabc778e3f0f5f8 (diff) |
ring_buffer: pahole struct ring_buffer
While fixing some bugs in pahole (built-in.o files were not being
processed due to relocation problems) I found out about these packable
structures:
$ pahole --packable kernel/trace/ring_buffer.o | grep ring
ring_buffer 72 64 8
ring_buffer_per_cpu 112 104 8
If we take a look at the current layout of struct ring_buffer we can see
that we have two 4 bytes holes.
$ pahole -C ring_buffer kernel/trace/ring_buffer.o
struct ring_buffer {
unsigned int pages; /* 0 4 */
unsigned int flags; /* 4 4 */
int cpus; /* 8 4 */
/* XXX 4 bytes hole, try to pack */
cpumask_var_t cpumask; /* 16 8 */
atomic_t record_disabled; /* 24 4 */
/* XXX 4 bytes hole, try to pack */
struct mutex mutex; /* 32 32 */
/* --- cacheline 1 boundary (64 bytes) --- */
struct ring_buffer_per_cpu * * buffers; /* 64 8 */
/* size: 72, cachelines: 2, members: 7 */
/* sum members: 64, holes: 2, sum holes: 8 */
/* last cacheline: 8 bytes */
};
So, if I ask pahole to reorganize it:
$ pahole -C ring_buffer --reorganize kernel/trace/ring_buffer.o
struct ring_buffer {
unsigned int pages; /* 0 4 */
unsigned int flags; /* 4 4 */
int cpus; /* 8 4 */
atomic_t record_disabled; /* 12 4 */
cpumask_var_t cpumask; /* 16 8 */
struct mutex mutex; /* 24 32 */
struct ring_buffer_per_cpu * * buffers; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
/* size: 64, cachelines: 1, members: 7 */
}; /* saved 8 bytes and 1 cacheline! */
We get it using just one 64 bytes cacheline.
To see what it did:
$ pahole -C ring_buffer --reorganize --show_reorg_steps \
kernel/trace/ring_buffer.o | grep \/
/* Moving 'record_disabled' from after 'cpumask' to after 'cpus' */
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions