All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@mandriva.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, lwn@lwn.net
Subject: Re: [ANNOUNCE] pahole and other DWARF2 utilities
Date: Tue, 31 Oct 2006 17:45:32 -0300	[thread overview]
Message-ID: <20061031204532.GG5319@mandriva.com> (raw)
In-Reply-To: <20061031172237.GD5319@mandriva.com>

On Tue, Oct 31, 2006 at 02:22:37PM -0300, Arnaldo Carvalho de Melo wrote:
> On Mon, Oct 30, 2006 at 08:33:34PM -0800, Andrew Morton wrote:
> > On Mon, 30 Oct 2006 18:33:19 -0300
> > Arnaldo Carvalho de Melo <acme@mandriva.com> wrote:
> > 
> > > 	I've been working on some DWARF2 utilities and thought that it
> > > is about time I announce it to the community, so that what is already
> > > available can be used by people interested in reducing structure sizes
> > > and otherwise taking advantage of the information available in the elf
> > > sections of files compiled with 'gcc -g' or in the case of the kernel
> > > with CONFIG_DEBUG_INFO enabled, so here it goes the description of said
> > > tools:
> > > 
> > > pahole: Poke-a-Hole is a tool to find out holes in structures, holes
> > > being defined as the space between members of functions due to alignemnt
> > > rules that could be used for new struct entries or to reorganize
> > > existing structures to reduce its size, without more ado lets see what
> > > that means:
> > > 
> > > ...
> > >
> > > 	Further ideas on how to use the DWARF2 information include tools
> > > that will show where inlines are being used, how much code is added by
> > > inline functions,
> > 
> > It would be quite useful to be able to identify inlined functions which are
> > good candidates for uninlining.

For now people can take a look at:

http://oops.merseine.nu:81/acme/net.ipv4.tcp.o.pahole

Where all the types in headers included from net/ipv4/tcp.c that have
holes can be seen, for instance:

/* /pub/scm/linux/kernel/git/acme/net-2.6/include/linux/dqblk_xfs.h:143
 * */
struct fs_quota_stat {
        __s8             qs_version;           /*     0     1 */

        /* XXX 1 bytes hole, try to pack */

        __u16            qs_flags;             /*     2     2 */
        __s8             qs_pad;               /*     4     1 */

        /* XXX 3 bytes hole, try to pack */

        fs_qfilestat_t   qs_uquota;            /*     8    20 */
        fs_qfilestat_t   qs_gquota;            /*    28    20 */
        __u32            qs_incoredqs;         /*    48     4 */
        __s32            qs_btimelimit;        /*    52     4 */
        __s32            qs_itimelimit;        /*    56     4 */
        __s32            qs_rtbtimelimit;      /*    60     4 */
        __u16            qs_bwarnlimit;        /*    64     2 */
        __u16            qs_iwarnlimit;        /*    66     2 */
}; /* size: 68, sum members: 64, holes: 2, sum holes: 4 */


	See? two holes, that can be combined and reduce the size of this
struct by 4 bytes, just moving qs_pad to be defined just before
qs_flags, many more holes are there to harvest :-)

	Of course, mistakes from the past for structs that are exported
to userspace have to be kept that way, and in other cases where grouping
members for cacheline locality optimizations, etc.

- Arnaldo

  reply	other threads:[~2006-10-31 20:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 21:33 [ANNOUNCE] pahole and other DWARF2 utilities Arnaldo Carvalho de Melo
2006-10-31  4:33 ` Andrew Morton
2006-10-31 16:05   ` Thiago Galesi
2006-10-31 17:28     ` Arnaldo Carvalho de Melo
2006-10-31 17:22   ` Arnaldo Carvalho de Melo
2006-10-31 20:45     ` Arnaldo Carvalho de Melo [this message]
2006-11-03 15:51   ` Arnaldo Carvalho de Melo
2006-11-03 19:07   ` Arnaldo Carvalho de Melo
2006-11-04 21:03     ` Top 100 inline functions (make allyesconfig) was " Arnaldo Carvalho de Melo
2006-11-05  6:30       ` Adrian Bunk
2006-11-05 16:42         ` Arnaldo Carvalho de Melo

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=20061031204532.GG5319@mandriva.com \
    --to=acme@mandriva.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lwn@lwn.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.